3 out of 9 rated this helpful - Rate this topic

CreateRestorePoint method of the SystemRestore Class

Applies to: desktop apps only

Creates a restore point.

This method is the scriptable equivalent of the SRSetRestorePoint function.

Syntax

uint32 CreateRestorePoint(
  [in]  String Description,
  [in]  uint32 RestorePointType,
  [in]  uint32 EventType
);

Parameters

Description [in]

The description to be displayed so the user can easily identify a restore point. The maximum length of an ANSI string is MAX_DESC. The maximum length of a Unicode string is MAX_DESC_W. For more information, see Restore Point Description Text.

RestorePointType [in]

The type of restore point. This member can be one of the following values.

Restore point typeMeaning
APPLICATION_INSTALL
0

An application has been installed.

APPLICATION_UNINSTALL
1

An application has been uninstalled.

DEVICE_DRIVER_INSTALL
10

A device driver has been installed.

MODIFY_SETTINGS
12

An application has had features added or removed.

CANCELLED_OPERATION
13

An application needs to delete the restore point it created. For example, an application would use this flag when a user cancels an installation.

 

EventType [in]

The type of event. This member can be one of the following values.

Event typeMeaning
BEGIN_NESTED_SYSTEM_CHANGE
102

A system change has begun. A subsequent nested call does not create a new restore point.

Subsequent calls must use END_NESTED_SYSTEM_CHANGE, not END_SYSTEM_CHANGE.

BEGIN_SYSTEM_CHANGE
100

A system change has begun.

A subsequent call must use END_SYSTEM_CHANGE, not END_NESTED_SYSTEM_CHANGE.

END_NESTED_SYSTEM_CHANGE
103

A system change has ended.

END_SYSTEM_CHANGE
101

A system change has ended.

 

Return value

If the method succeeds, the return value is S_OK. Otherwise, the method returns one of the COM error codes defined in WinError.h.

Examples

'CreateRestorePoint Method of the SystemRestore Class
'Creates a restore point. Specifies the beginning and 
'the ending of a set of changes so that System Restore 
'can create a restore point.This method is the 
'scriptable equivalent of the SRSetRestorePoint function.

Set Args = wscript.Arguments
If Args.Count() > 0 Then
    RpName = Args.item(0)
Else 
    RpName = "Vbscript"
End If

Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")

If (obj.CreateRestorePoint(RpName, 0, 100)) = 0 Then
    wscript.Echo "Success"
Else 
    wscript.Echo "Failed"
End If

Requirements

Minimum supported client

Windows XP

Minimum supported server

None supported

Namespace

\\.\Root\Default

MOF

Sr.mof

See also

SystemRestore

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ