Updated ping-host.ps1

This commit is contained in:
Markus Fleschutz 2024-12-28 16:46:20 +01:00
parent 7841c95ad7
commit 1a0daf2109

View File

@ -24,9 +24,12 @@ try {
if ($ping.Status -eq "Success") {
Write-Output "✅ Host '$hostname' at IP $($ping.Address) is up with $($ping.RoundtripTime)ms latency."
exit 0 # success
} else {
Write-Output "⚠️ No reply from '$hostname' (IP $($ping.Address)) - check the connection or maybe the host is down."
exit 1
}
}
Write-Output "⚠️ Host '$hostname' doesn't respond - check the connection or maybe the host is down."
Write-Output "⚠️ No reply from host '$hostname' - check the connection or maybe the host is down."
exit 1
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"