mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 13:04:59 +02:00
Updated ping-internet.ps1
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user