mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-21 15:33:15 +01:00
Updated ping-internet.ps1
This commit is contained in:
parent
01a00dd30f
commit
8deb881f99
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user