Skip to content

Commit b566599

Browse files
committed
Update check-dns.ps1
1 parent 7733f82 commit b566599

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Data/domain-names.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ update.googleapis.com
159159
wetter.com
160160
wttr.in
161161
www.apple.com
162+
www.arte.tv
162163
www.bbc.co.uk
163164
www.bild.de
164165
www.booking.com

Scripts/check-dns.ps1

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,28 @@
55
This PowerShell script checks the DNS resolution using frequently used domain names.
66
.EXAMPLE
77
PS> ./check-dns
8-
56.7 domains per second DNS resolution
98
.LINK
109
https://github.com/fleschutz/PowerShell
1110
.NOTES
1211
Author: Markus Fleschutz | License: CC0
1312
#>
1413

1514
try {
16-
write-progress "Reading table from Data/domain-names.csv..."
15+
"⏳ Step 1/2 - Reading table from Data/domain-names.csv..."
1716
$Table = Import-CSV "$PSScriptRoot/../Data/domain-names.csv"
18-
$Count = $Table.Length
17+
$NumRows = $Table.Length
1918

20-
write-progress "Resolving $Count domain names..."
19+
"⏳ Step 2/2 - Resolving $NumRows domain names..."
2120
$StopWatch = [system.diagnostics.stopwatch]::startNew()
2221
if ($IsLinux) {
2322
foreach($Row in $Table) { $null = dig $Row.Domain +short }
2423
} else {
2524
foreach($Row in $Table) { $null = Resolve-DNSName $Row.Domain }
2625
}
27-
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
2826

29-
$Average = [math]::round($Count / $Elapsed, 1)
30-
"$Average domains per second DNS resolution"
27+
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
28+
$Average = [math]::round($NumRows / $Elapsed, 1)
29+
"✔️ DNS resolves $Average domains per second"
3130
exit 0 # success
3231
} catch {
3332
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

0 commit comments

Comments
 (0)