mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-22 21:58:42 +01:00
Update check-dns.ps1
This commit is contained in:
parent
1709e7343e
commit
31ef9cf5d0
@ -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])"
|
||||||
|
Loading…
Reference in New Issue
Block a user