Hi
I am new to VBscript, trying to run below script to ping machine reading input file and ping result should be in stored in lower case based on if the machine is online of offline. However when running the file getting error"The system cannot find the
file specified." on line "Objshell.Exec("ping"&strcomputer)"
Any idea why it is showing this error please
Regards,
Madhan
Setfso=CreateObject("Scripting.Filesystemobject")
Setobjshell=CreateObject("WScript.shell")
SetobjInputFile=fso.OpenTextFile("D:\Madhan\Learning\VBScript\Logs\Computers.log",1,True)
SetobjOutputFile=fso.OpenTextFile("D:\Madhan\Learning\VBScript\Logs\Results.log",2,True)
DoWhileobjinputFile.AtEndOfLine<>True
strComputer=objInputFile.ReadLine
SetobjScriptExec=Objshell.Exec("ping"&strcomputer)
strPingResults=LCase(objScriptExec.StdOut.ReadAll)
WScript.EchostrPingResults
IfInStr(strPingResults,"replyfrom")Then
WScript.Echo"Themachineisup!"
Else
WScript.Echo"TheMachineiddown!"
EndIf
Loop
- Edited by madhanagoapl Saturday, June 20, 2015 12:44 PM