Update check-dns.ps1

This commit is contained in:
Markus Fleschutz 2022-09-08 20:39:46 +02:00
parent 1709e7343e
commit 31ef9cf5d0
2 changed files with 4 additions and 4 deletions

View File

@ -12,11 +12,11 @@
#> #>
try { try {
"⏳ Step 1/2 - Reading table from Data/domain-names.csv..." "⏳ Step 1/2 - Reading table from Data/domains.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/domain-names.csv" $Table = Import-CSV "$PSScriptRoot/../Data/domains.csv"
$NumRows = $Table.Length $NumRows = $Table.Length
"⏳ Step 2/2 - Resolving $NumRows domain names..." "⏳ Step 2/2 - Resolving $NumRows domains..."
$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 }
@ -26,7 +26,7 @@ try {
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds [float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
$Average = [math]::round($NumRows / $Elapsed, 1) $Average = [math]::round($NumRows / $Elapsed, 1)
"✔️ DNS resolves $Average domains per second" "✔️ DNS resolution is $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])"