This is just a test of the new sourcecode formatting on WordPress.com.
Here’s a function to test if a host is pingable. I usually do this check before attempting anything else on a remote system. It’s a useful function to use in other scripts, or have available in your profile.
function test-ping ( [string]$server )
{
# if $server doesn't resolve, we'd bomb without the 'trap' with a
# System.Net.NetworkInformation.PingException or System.Net.Sockets.SocketException
trap { return $false; }
$ping = New-Object System.Net.NetworkInformation.Ping
if ($ping)
{
$rslt = $ping.Send($server)
if ($rslt -and ($rslt.Status.ToString() –eq “Success”))
{
$ping = $null
return $true
}
$ping = $null
}
return $false
}
Google’s products are renowned for being in beta for ages – in fact it’s become
Recent Comments