1
0
mirror of https://github.com/fleschutz/PowerShell.git synced 2025-04-23 10:28:23 +02:00

Update check-dns.ps1

This commit is contained in:
Markus Fleschutz 2023-10-08 12:48:06 +02:00
parent fd0f6844fb
commit dfe7444ca7

View File

@ -13,9 +13,9 @@
#> #>
try { try {
Write-Progress "⏳ Measuring DNS resolution..."
$table = Import-CSV "$PSScriptRoot/../Data/popular-domains.csv" $table = Import-CSV "$PSScriptRoot/../Data/popular-domains.csv"
$numRows = $table.Length $numRows = $table.Length
Write-Progress "⏳ Resolving $numRows domain names..."
$stopWatch = [system.diagnostics.stopwatch]::startNew() $stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) { if ($IsLinux) {
@ -23,13 +23,14 @@ try {
} else { } else {
foreach($row in $table){$nop=Resolve-DNSName $row.Domain} foreach($row in $table){$nop=Resolve-DNSName $row.Domain}
} }
Write-Progress -completed "."
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds [float]$elapsed = $stopWatch.Elapsed.TotalSeconds
Write-Progress -completed " "
$average = [math]::round($numRows / $elapsed, 1) $average = [math]::round($numRows / $elapsed, 1)
if ($average -lt 10.0) { if ($average -lt 10.0) {
Write-Output "⚠️ DNS resolves $average domains per second only" Write-Host "⚠️ DNS resolves $average domains per second only"
} else { } else {
Write-Output "✅ DNS resolves $average domains per second" Write-Host "✅ DNS resolves $average domains per second"
} }
exit 0 # success exit 0 # success
} catch { } catch {