Update check-dns.ps1

This commit is contained in:
Markus Fleschutz 2022-09-08 20:23:04 +02:00
parent 7733f82fac
commit b566599a71
2 changed files with 7 additions and 7 deletions

View File

@ -159,6 +159,7 @@ update.googleapis.com
wetter.com
wttr.in
www.apple.com
www.arte.tv
www.bbc.co.uk
www.bild.de
www.booking.com

1 Domain
159 wetter.com
160 wttr.in
161 www.apple.com
162 www.arte.tv
163 www.bbc.co.uk
164 www.bild.de
165 www.booking.com

View File

@ -5,7 +5,6 @@
This PowerShell script checks the DNS resolution using frequently used domain names.
.EXAMPLE
PS> ./check-dns
56.7 domains per second DNS resolution
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -13,21 +12,21 @@
#>
try {
write-progress "Reading table from Data/domain-names.csv..."
"⏳ Step 1/2 - Reading table from Data/domain-names.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/domain-names.csv"
$Count = $Table.Length
$NumRows = $Table.Length
write-progress "Resolving $Count domain names..."
"⏳ Step 2/2 - Resolving $NumRows domain names..."
$StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) {
foreach($Row in $Table) { $null = dig $Row.Domain +short }
} else {
foreach($Row in $Table) { $null = Resolve-DNSName $Row.Domain }
}
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
$Average = [math]::round($Count / $Elapsed, 1)
"$Average domains per second DNS resolution"
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
$Average = [math]::round($NumRows / $Elapsed, 1)
"✔️ DNS resolves $Average domains per second"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"