Restore method of the SystemRestore class

Initiates a system restore. The caller must force a system reboot. The actual restoration occurs during the reboot.

Syntax


uint32 Restore(
  [in] uint32 SequenceNumber
);

Parameters

SequenceNumber [in]

The sequence number of the restore point. To determine the sequence number for a specific restore point, enumerate all restore points on the system.

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


'Restore Method of the SystemRestore Class
'Initiates a system restore. The caller must 
'force a system reboot. The actual restoration 
'occurs during the reboot.
Set Args = wscript.Arguments
RpNum = Args.item(0)
Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
if obj.Restore(RpNum) <> 0 Then
    wscript.Echo "Restore failed"
End If
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
    OpSys.Reboot()
next


Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

None supported

Namespace

Root\\Default

MOF

Sr.mof

See also

SystemRestore

 

 

Show: