I am newbie with scripting and programming. I have a VB script that run a
ping.exe command to see if the other server is up. The ping.exe VB scripts
works fine but I would like to include a statement where if the ping command
return request time out (the other server is down) instead of a reply
(meaning the other server is up) then it will call the batch file call
service.bat. here is my code for the ping VB script and the batch file. How
could I do this?
Ping VB Script:
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec("ping 10.0.0.1 -t")
Set objStdOut = objWshScriptExec.StdOut
Do Until objStdOut.AtEndOfStream
strLine = objStdOut.ReadLine
If Len(strLine) > 2 Then
WScript.Echo Now & " -- " & strLine
Else
Wscript.Echo strLine
End If
Loop
Batch File to start Windows Service
sc start WZCSVC