mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-16 17:51:28 +01:00
Update check-dns.ps1
This commit is contained in:
parent
fd0f6844fb
commit
dfe7444ca7
@ -13,9 +13,9 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
Write-Progress "⏳ Measuring DNS resolution..."
|
||||
$table = Import-CSV "$PSScriptRoot/../Data/popular-domains.csv"
|
||||
$numRows = $table.Length
|
||||
Write-Progress "⏳ Resolving $numRows domain names..."
|
||||
|
||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
if ($IsLinux) {
|
||||
@ -23,13 +23,14 @@ try {
|
||||
} else {
|
||||
foreach($row in $table){$nop=Resolve-DNSName $row.Domain}
|
||||
}
|
||||
Write-Progress -completed "."
|
||||
[float]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
|
||||
Write-Progress -completed " "
|
||||
$average = [math]::round($numRows / $elapsed, 1)
|
||||
if ($average -lt 10.0) {
|
||||
Write-Output "⚠️ DNS resolves $average domains per second only"
|
||||
Write-Host "⚠️ DNS resolves $average domains per second only"
|
||||
} else {
|
||||
Write-Output "✅ DNS resolves $average domains per second"
|
||||
Write-Host "✅ DNS resolves $average domains per second"
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user