Updated ping-internet.ps1

This commit is contained in:
Markus Fleschutz 2024-10-23 18:44:11 +02:00
parent 01a00dd30f
commit 8deb881f99
2 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@
This PowerShell script measures the DNS resolution speed using 100 internet domains and prints it.
.EXAMPLE
PS> ./check-dns.ps1
Internet DNS queries take 33.6ms
Internet DNS lookups in 33.6ms
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -25,9 +25,9 @@ try {
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds * 1000.0
$speed = [math]::round($elapsed / $table.Length, 1)
if ($speed -gt 100.0) {
Write-Host "⚠️ Internet DNS queries are $($speed)ms slow"
Write-Host "⚠️ Internet DNS lookups take $($speed)ms!"
} else {
Write-Host "✅ Internet DNS queries take $($speed)ms"
Write-Host "✅ Internet DNS lookups in $($speed)ms"
}
exit 0 # success
} catch {

View File

@ -7,7 +7,7 @@
Specifies the hosts to ping, seperated by commata (10 Internet servers by default)
.EXAMPLE
PS> ./ping-internet.ps1
Internet ping latency 12ms (9...18ms range)
Internet ping takes 12ms (9...18ms range)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -34,12 +34,12 @@ try {
[int]$loss = $total - $success
if ($success -eq 0) {
Write-Host "⚠️ Internet offline (100% ping loss)"
} elseif ($loss -eq 0) {
[float]$speed = [math]::round([float]$avg / [float]$success, 1)
Write-Host "✅ Internet ping latency $($speed)ms ($($min)...$($max)ms range)"
} else {
} elseif ($loss -gt 0) {
[float]$speed = [math]::round([float]$avg / [float]$success, 1)
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 takes $($speed)ms ($($min)...$($max)ms range)"
}
exit 0 # success
} catch {