Share via


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