共用方式為


SystemRestore 類別的 Restore 方法

起始系統還原。 呼叫端必須強制系統重新開機。 實際還原會在重新開機期間發生。

語法

uint32 Restore(
  [in] uint32 SequenceNumber
);

參數

SequenceNumber [in]

還原點的序號。 若要判斷特定還原點的序號,請列舉系統上的所有還原點。

傳回值

如果方法成功,傳回值會S_OK。 否則,方法會傳回 WinError.h 中定義的其中一個 COM 錯誤碼。

範例

'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

規格需求

需求
最低支援的用戶端
Windows XP [僅限傳統型應用程式]
最低支援的伺服器
都不支援
命名空間
Root\\Default
MOF
Sr.mof

另請參閱

SystemRestore