Updated ping-internet.ps1

This commit is contained in:
Markus Fleschutz
2025-08-06 15:29:55 +02:00
parent 7e7b318aaf
commit b4c21affde

View File

@ -1,13 +1,13 @@
<#
.SYNOPSIS
Pings remote hosts to measure the latency
Measures the latency to Internet hosts
.DESCRIPTION
This PowerShell script measures the ping roundtrip times from the local computer to remote ones (10 Internet servers by default).
This PowerShell script measures the ping roundtrip times from the local computer to 10 Internet servers.
.PARAMETER hosts
Specifies the hosts to ping, seperated by commata (10 Internet servers by default)
.EXAMPLE
PS> ./ping-internet.ps1
✅ Internet ping: 12ms (9...18ms range)
✅ Internet ping is 12ms (9...18ms range)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -39,10 +39,10 @@ try {
Write-Host "✅ Online with $loss/$total ping loss and $($min)...$($max)ms latency - $($speed)ms average"
} else {
[float]$speed = [math]::round([float]$avg / [float]$success, 1)
Write-Host "✅ Internet ping: $($speed)ms ($min...$($max)ms range)"
Write-Host "✅ Internet ping is $($speed)ms ($min...$($max)ms range)"
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
"⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
exit 1
}