If you want to check availablity of some remote host in your powershell script you can use next simple piece of code to do exactly this:$MachineName = “mo-laptop”
$PingStatus = Gwmi Win32_PingStatus -Filter “Address =’$MachineName’” | Select-Object StatusCode
if($PingStatus.StatusCode -eq 0)
{
echo $MachineName
echo “Ping Success”
}
else
{
echo $MachineName
echo “Ping Failed”
}