Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ping to see if machine is on

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
GB
Hi

I have a VB.NET program that audits the software on a PC and also detects it's operating system. I have found that if it tries to audit a PC that is switched off the program can get stuck so I have tried to ping a machine first and if it's unresponsive to move on to the next PC.

Generally speaking this works fine but we have a machine that is returning a ping but all is not "on":

Code:
H:\>ping lt104

Pinging lt104.bb01.com [10.5.7.116] with 32 bytes of data:

Reply from 154.32.149.205: Destination net unreachable.
Reply from 154.32.149.205: Destination net unreachable.
Reply from 154.32.149.205: Destination net unreachable.
Reply from 154.32.149.205: Destination net unreachable.

Ping statistics for 10.5.7.116:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Is there a way of saying that if there is a ping response saying unreachable then this should count as a fail?

Thanks very much - or if there is a more reliable way of saying if a machine is off or on that would be handy.

Ed
 
Something like this should work.

Code:
If My.Computer.Network.Ping("10.5.7.116") Then
    Console.WriteLine("Machine On")
Else
    Console.WriteLine("Machine Off")
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top