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 wetter.com
wttr.in wttr.in
www.apple.com www.apple.com
www.arte.tv
www.bbc.co.uk www.bbc.co.uk
www.bild.de www.bild.de
www.booking.com 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. This PowerShell script checks the DNS resolution using frequently used domain names.
.EXAMPLE .EXAMPLE
PS> ./check-dns PS> ./check-dns
56.7 domains per second DNS resolution
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -13,21 +12,21 @@
#> #>
try { 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" $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() $StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) { if ($IsLinux) {
foreach($Row in $Table) { $null = dig $Row.Domain +short } foreach($Row in $Table) { $null = dig $Row.Domain +short }
} else { } else {
foreach($Row in $Table) { $null = Resolve-DNSName $Row.Domain } foreach($Row in $Table) { $null = Resolve-DNSName $Row.Domain }
} }
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
$Average = [math]::round($Count / $Elapsed, 1) [float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"$Average domains per second DNS resolution" $Average = [math]::round($NumRows / $Elapsed, 1)
"✔️ DNS resolves $Average domains per second"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"