Small function to test connectivity to a server.
function test-connection {
$pingtest = ping $args[0] -n 1
if ($pingtest -match 'TTL=') {
Write-Output $true
} else {
Write-host $false
}
}
Usage:
test-connection MyServer01.domain.com
Tuesday, January 02, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
I would suggest to change the match to "TTL=" cause you can catch "TTL expired in transit",
which means that the request did not get to the server in time, probably because it couldn't get past the router.
"TTL=" means that your ping response was successful.
Post a Comment