1
0
mirror of https://github.com/fleschutz/PowerShell.git synced 2025-07-04 22:50:05 +02:00

Updated check-dns.ps1

This commit is contained in:
Markus Fleschutz
2024-12-27 09:21:09 +01:00
parent 587732eb3f
commit 64bcdee5e8

@ -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 lookups in 33.6ms
✅ Internet DNS: 33.6ms lookup time
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -24,10 +24,12 @@ try {
}
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds * 1000.0
$speed = [math]::round($elapsed / $table.Length, 1)
if ($speed -gt 100.0) {
Write-Host "⚠️ Internet DNS lookups take $($speed)ms!"
if ($speed -lt 10.0) {
Write-Output " Internet DNS: $($speed)ms excellent lookup time"
} elseif ($speed -lt 100.0) {
Write-Output "✅ Internet DNS: $($speed)ms lookup time"
} else {
Write-Host " Internet DNS lookups in $($speed)ms"
Write-Output "⚠️ Internet DNS: $($speed)ms slow lookup time"
}
exit 0 # success
} catch {