strS
ubNet = "192.168.1."
Set objFSO= CreateObject("Scripting.File
SystemObject")
Set objTS = objfso.CreateTextFile("e:\PingResult.txt")
For i = 1 To 254
strComputer = strSubNet &
amp; i
blnResult = Ping(strComputer)
If blnResult = True Then
objTS.Wr
ITeLine "Ping " & strComputer & " success!"
End If
Next
objTS.Close
WScript.Echo "Done!"
Function Ping(strComputer)
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * @R_
406_2150@ Win32_Ping
status Where Address='" & strComputer & "'")
For
each ob
JITem In colItems
Select case objItem.StatusCode
Case 0
Ping = True
Case Else
Ping = False
End select
Exit For
Next
End Function