From b2bb0b8ca18333a22ea23dd52998ba06de362497 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 6 Feb 2025 15:33:02 +0100 Subject: [PATCH] Updated ping-host.ps1 --- scripts/ping-host.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ping-host.ps1 b/scripts/ping-host.ps1 index b8e22b05..9658efcf 100755 --- a/scripts/ping-host.ps1 +++ b/scripts/ping-host.ps1 @@ -7,7 +7,7 @@ Specifies the hostname or IP address to ping (x.com by default) .EXAMPLE PS> ./ping-host.ps1 x.com - ✅ Host 'x.com' with 20ms latency at IP 104.244.42.1 is up 👍 + ✅ 'x.com' is up 👍 (20ms to IP 104.244.42.1) .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -22,14 +22,14 @@ try { [Threading.Tasks.Task]::WaitAll($tasks) foreach($ping in $tasks.Result) { if ($ping.Status -eq "Success") { - Write-Output "✅ Host '$hostname' with $($ping.RoundtripTime)ms latency at IP $($ping.Address) is up 👍" + Write-Output "✅ '$hostname' is up 👍 ($($ping.RoundtripTime / 2)ms to IP $($ping.Address))" 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 "⚠️ No reply from host '$hostname' - check the connection or maybe the host is down." + Write-Output "⚠️ No reply from '$hostname' - check the connection or maybe the host is down." exit 1 } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"