VBS Ping Reply Function Return

In Knowledge Base Blog by angeladmin

strComputer=”Example”

MsgBox PingReply

Function PingReply
Set objPing = GetObject(“winmgmts:{impersonationLevel=impersonate}”).ExecQuery(“select StatusCode from Win32_PingStatus where address = ‘” & strComputer & “‘ and Resolveaddressnames=true”)
For Each objStatus in objPing
If objStatus.StatusCode=0 Then
PingReply=True
Else
PingReply=False
End If
Next
Set objPing=Nothing
Set objStatus=Nothing
End Function

Angel Computers – Contact Us