Determine Network Connectivity

Set WshShell = CreateObject(“WScript.Shell”)
Set objExecObject = WshShell.Exec (“ping -n 3 -w 1000 www.google.com”)

‘ Error Running Ping
If objExecObject.ExitCode <> 0 Then
IsAlive = “UnResolved”
Else
‘ Check if Computer is Alive
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadAll()
If Instr(strText, “Reply”) > 0 Then
IsAlive = “Alive”
msgbox “Alive”
Else
IsAlive = “Dead”
msgbox “Dead”
End If
Loop
End If

email me