Ping a server and get results:
***************
$ping = new-object System.Net.Networkinformation.Ping
$result = $ping.send("ServerName")
write-host $result.status
***************
Or
***************
$ip =”ServerName”
$qry = ('select statuscode from win32_pingstatus where address="' + $ip + '"')
$rslt = gwmi –query “$qry”
if ($rslt.StatusCode –eq 0) {
write-host “ping worked” -BackgroundColor "Green"
}
else {
write-host “ping failed” -BackgroundColor "Red"
}
***************
Join The Fabric User Research Panel!
-
As you probably know, I work on the Fabric Customer Advisory Team at
Microsoft. Apart from advising customers a lot of our team’s time is spent
collecting ...
3 days ago
No comments:
Post a Comment