User999999
User999999

Reputation: 2520

My.Computer.Network.Ping(<<servername>>) always returns true

I'm trying to monitor if the other PC's in our network are up or are shutdown. Following myresearch I found My.Computer.Network.Ping is way to do this.

Determine if remote Computer is available

MSDN

So i created a testproject where i'm pinging 5 workstations.

WS0001 (non - existant)
WS0002 (non - existant)
WS3102 (existant)
WS3207 (existant)
WS3306 (existant)

However method My.Computer.Network.Ping always returns true no matter if the workstation exists or not.

Question: Would anyone know why it falsely returns true?

I'm using the method as following. m_Parameters("workstation") is one of the workstation metionned above.

If My.Computer.Network.Ping(m_Parameters("workstation")) Then
   'The PC is available in the company network
Else
   ' The Pc is unavailable in the company network
End If

Note : Using My.Computer.Network.IsAvailable does not resolve the issue. I want information about the other workstations not my own.

Note 2: Screenshot from my commandprompt Translation: "Ping Request could not find host ws0001. Please check the hostname and try again." WS3320 is the computer of a colleague of mine. WS0001 is our "Test Workstation" which is now not running (since more then 5 months) and is no longer known in our domain.

enter image description here

Thnx for the help sofar!

Upvotes: 2

Views: 1937

Answers (1)

Sam Makin
Sam Makin

Reputation: 1556

Try using this method instead.

msdn.microsoft.com/en-us/library/system.net.networkinformation.ping%28v=vs.110%29.aspx

Upvotes: 1

Related Questions