'wbadmin 状況確認&自動復元&メール送信スクリプト
' 2010/10/24 by kenrouse
'------------------------------------------------
bRet = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set tso = fso.CreateTextFile("status.txt", true)
' 直前に実行されたバックアップの終了を待つコマンドです。
command = "wbadmin.exe get status"
' コマンドを実行します。
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oExec = WshShell.Exec(command)
' コマンドの出力結果を読み取ります。※ただし、進捗表示の出力は除去
Do While oExec.StdOut.AtEndOfStream <> True
strline = oExec.StdOut.ReadLine
If InStr(strline, "%") = 0 Then
tso.WriteLine strline
End If
'If InStr(strline, "バックアップ操作が正常に完了") = 1 Then
If InStr(strline, "エラー") = 1 Then
bRet = 1
End If
Loop
WScript.Sleep 1000
tso.Close
Wscript.Quit bRet