mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-10 10:48:31 +02:00
Improved check-dns-resolution.ps1
This commit is contained in:
parent
dbea806772
commit
c297f70046
@ -6,26 +6,22 @@
|
|||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
Set-StrictMode -Version Latest
|
|
||||||
|
|
||||||
$PathToRepo = "$PSScriptRoot/.."
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StartTime = Get-Date
|
$StartTime = Get-Date
|
||||||
|
|
||||||
write-progress "Reading Data/domain-names.csv..."
|
write-progress "Reading Data/domain-names.csv..."
|
||||||
|
$PathToRepo = "$PSScriptRoot/.."
|
||||||
$Table = import-csv "$PathToRepo/Data/domain-names.csv"
|
$Table = import-csv "$PathToRepo/Data/domain-names.csv"
|
||||||
|
|
||||||
foreach($Row in $Table) {
|
foreach($Row in $Table) {
|
||||||
$Domain = $Row.Domain
|
write-progress "Resolving $($Row.Domain) ..."
|
||||||
write-progress "Resolving $Domain..."
|
$Ignore = nslookup $Row.Domain
|
||||||
$Ignore = nslookup $Domain
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$Count = $Table.Length
|
$Count = $Table.Length
|
||||||
$StopTime = Get-Date
|
$StopTime = Get-Date
|
||||||
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
|
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
|
||||||
write-host -foregroundColor green "OK - resolved $Count domain names in $TimeInterval seconds"
|
write-host -foregroundColor green "OK - resolved $Count domain names in $($TimeInterval.seconds) seconds"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user