on error resume nextSet objfso = CreateObject("scripting.filesystemobject")Set objinputfile = objfso.OpenTextFile("machines.txt",1)Set objOutputfileGood = objfso.CreateTextFile("PING-GOOD.txt",1)Set objOutputfileFail = objfso.CreateTextFile("PING-FAIL.txt",1)Do Until ObjInputFile.AtEndOfStreamStrComputerName = objinputfile.ReadLinestrQuery = "SELECT * FROM Win32_PingStatus WHERE Address = '" & StrComputerName & "'"' Run the WMI querySet colPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery( strQuery )' Translate the query results to either True or FalseFor Each objPingResult In colPingResultsIf Not IsObject( objPingResult ) ThenobjOutputfileFail.Writeline StrComputernameElseIf objPingResult.StatusCode = 0 ThenobjOutputfileGood.Writeline StrComputernameElseobjOutputfileFail.Writeline StrComputernameEnd IfNextloopWscript.Echo "Ping Test Completed"
Monday, 9 November 2015
Ping Test VBS
The following is a pretty handy Ping test script. I know it maybe should be PS but VBS is still handy.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment