mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-08 06:58:49 +01:00
Updated ping-host.ps1
This commit is contained in:
parent
7841c95ad7
commit
1a0daf2109
@ -24,9 +24,12 @@ try {
|
|||||||
if ($ping.Status -eq "Success") {
|
if ($ping.Status -eq "Success") {
|
||||||
Write-Output "✅ Host '$hostname' at IP $($ping.Address) is up with $($ping.RoundtripTime)ms latency."
|
Write-Output "✅ Host '$hostname' at IP $($ping.Address) is up with $($ping.RoundtripTime)ms latency."
|
||||||
exit 0 # success
|
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
|
exit 1
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user