From 328decd842c6ddd58083422c3c95c29ff614684f Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 2 Mar 2023 08:34:24 +0100 Subject: [PATCH] Update check-ping.ps1 --- Scripts/check-ping.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Scripts/check-ping.ps1 b/Scripts/check-ping.ps1 index cc0cda95..89c1c249 100755 --- a/Scripts/check-ping.ps1 +++ b/Scripts/check-ping.ps1 @@ -2,7 +2,7 @@ .SYNOPSIS Checks the ping latency .DESCRIPTION - This PowerShell script checks the ping latency from the local computer to the given hosts. + This PowerShell script checks the ping latency from the local computer to 9 popular hosts. .PARAMETER hosts Specifies the hosts to check, seperated by commata (default is: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com) .EXAMPLE @@ -17,11 +17,10 @@ param([string]$hosts = "amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com") try { - Write-Progress "⏳ Pinging hosts in parallel..." + Write-Progress "⏳ Sending a ping to 9 popular hosts..." $HostsArray = $hosts.Split(",") $Pings = Test-Connection -computerName $HostsArray -count 1 - Write-Progress "⏳ Calculating results..." [int]$Min = 9999999 [int]$Max = [int]$Avg = 0 foreach($Ping in $Pings) { @@ -32,8 +31,8 @@ try { } $Avg /= $Pings.count + Write-Progress -Completed "." Write-Host "✅ Ping latency is $($Min)ms...$($Max)ms, $($Avg)ms average" - Write-Progress -Completed "Ping finished." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"