mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-21 17:38:19 +02:00
Update check-dns.ps1
This commit is contained in:
parent
09306c0156
commit
f41205c332
@ -2,10 +2,10 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the DNS resolution
|
Checks the DNS resolution
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script checks the DNS resolution with frequently used domain names.
|
This PowerShell script checks the DNS resolution using frequently used domain names.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./check-dns
|
PS> ./check-dns
|
||||||
11.8 domains per second DNS resolution
|
56.7 domains per second DNS resolution
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -13,25 +13,19 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
write-progress "Reading table from Data/domain-names.csv..."
|
||||||
|
|
||||||
write-progress "Reading Data/domain-names.csv..."
|
|
||||||
$Table = Import-CSV "$PSScriptRoot/../Data/domain-names.csv"
|
$Table = Import-CSV "$PSScriptRoot/../Data/domain-names.csv"
|
||||||
|
|
||||||
if ($IsLinux) {
|
|
||||||
foreach($Row in $Table) {
|
|
||||||
write-progress "Resolving $($Row.Domain)..."
|
|
||||||
$null = dig $Row.Domain +short
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach($Row in $Table) {
|
|
||||||
write-progress "Resolving $($Row.Domain)..."
|
|
||||||
$null = Resolve-dnsName $Row.Domain
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$Count = $Table.Length
|
$Count = $Table.Length
|
||||||
|
|
||||||
|
write-progress "Resolving $Count 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 }
|
||||||
|
}
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
|
|
||||||
$Average = [math]::round($Count / $Elapsed, 1)
|
$Average = [math]::round($Count / $Elapsed, 1)
|
||||||
"$Average domains per second DNS resolution"
|
"$Average domains per second DNS resolution"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
Loading…
Reference in New Issue
Block a user