wmicで復元ポイントを作成する
SystemRestore Class を参考にやってみたがエラーになるな:
D:\>wmic path SystemRestore ノード - PCNAME エラー: 説明 = 無効なクラスです
検索してみたら namespaceオプションを指定する必要があるみたい。
名前空間なんてあるのか。WMIの仕組みとか全然知らないからな。
しかしメソッドを呼ぶと、またエラーになる。
D:\>wmic /namespace:\\root\default path SystemRestore call CreateRestorePoint "wmicのテスト", 0, 100 (SystemRestore)->CreateRestorePoint() を実行しています エラー: 説明 = パラメーターが間違っています。
うーん、おかしいな。メソッドまではたどり着いてるようだけれど、引数の指定方法が違うのかな。
さらに、あちこち引いたり押したりしてみると、
D:\>wmic /namespace:\\root\default path SystemRestore call CreateRestorePoint /?
呼び出し [ 入力/出力 ]パラメーター/種類 状態
==== ===================== ======
CreateRestorePoint [IN ]Description(String) Implemented
[IN ]EventType(uint32)
[IN ]RestorePointType(uint32)
[OUT]ReturnValue(uint32)
あ! 引数の順番がドキュメントと違うぞ。
というわけで、できました:
D:\>wmic /namespace:\\root\default path SystemRestore call CreateRestorePoint "wmicのテスト", 100, 0 (SystemRestore)->CreateRestorePoint() を実行しています メソッドが正しく実行しました。 出力パラメーター instance of __PARAMETERS { ReturnValue = 0; }; D:\>wmic /namespace:\\root\default path SystemRestore CreationTime Description EventType RestorePointType SequenceNumber 20101110042830.295377-000 Windows Update 100 18 129 20101115052857.931203-000 wmicのテスト 100 0 130
以上!