I wrote the following script and am experiencing a problem with it... What this script is supposed to do is go and ping an ip address and if it gets one of two answers then it will shutdown a unix machine via putty and plink. The two conditions its looking for is either a "reply timed out" or "destination host unreachable" if it gets either of them back it should run the plink session... If it does find them it should do nothing and just exit. Right now when i run the script.. I does not appear to be doing the check properly. I have been told there are much easier ways of doing this however... this is what i know so far... Assistance would be great..
Edit by Dumber: wrapped code tags around the script.
Set objShell=CreateObject("Wscript.shell") Set objWshScriptExec=objShell.exec("ping 192.168.0.200") Set objWshScriptExec2=objShell.exec("d:\plink -load") Set objStdOut=objWshScriptExec.Stdout While Not objStdOut.AtEndOfStream strLine=objStdOut.ReadLine If InStr(strLine,"Reply Timed Out") then objWshScriptExec2 elseif InStr(strLine,"Destination Host") then objWshScriptExec2 End If WEnd