AnoopGeorge.com

powershell ping test

3.03.2010

Blog

A way to test to see if the server is pingable

PS > # Using .NET method to ping test the servers
PS > $ping = new-object System.Net.NetworkInformation.Ping
PS > $ping.send($strComputer)

Status        : Success
Address       : 192.168.1.1
RoundtripTime : 0
Options       : System.Net.NetworkInformation.PingOptions
Buffer        : {97, 98, 99, 100…}

 

# Using .NET method to ping test the servers
$ping = new-object System.Net.NetworkInformation.Ping

$Reply = $ping.send($strComputer)
if($Reply.status -eq “success”)
{
#Do something here …
}

You must be logged in to post a comment.