Skip to content

Instantly share code, notes, and snippets.

@Avinashachu007
Last active September 5, 2015 08:04
Show Gist options
  • Save Avinashachu007/23ccb3611b986eda222a to your computer and use it in GitHub Desktop.
Save Avinashachu007/23ccb3611b986eda222a to your computer and use it in GitHub Desktop.
$ping = new-object System.Net.NetworkInformation.Ping
$reply = $ping.send('127.0.0.1')
if ($reply.status -eq "Success"){
[string]::Format("Reply from {0},time={1}",$reply.Address.ToString(),$reply.RoundtripTime)
}else{
$z = [system.net.dns]::gethostaddresses($hostname)[0].ipaddresstostring
[string]::Format("FAIL,{0},{1}",$z,"***")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment