mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-27 04:08:44 +02:00
Update check-dns.ps1
This commit is contained in:
parent
7733f82fac
commit
b566599a71
@ -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
|
||||||
|
|
@ -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])"
|
||||||
|
Loading…
Reference in New Issue
Block a user