mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-27 17:19:16 +01:00
31 lines
934 B
PowerShell
Executable File
31 lines
934 B
PowerShell
Executable File
#!/bin/powershell
|
|
<#
|
|
.SYNTAX ./check-dns-resolution.ps1
|
|
.DESCRIPTION checks the DNS resolution with frequently used domain names
|
|
.LINK https://github.com/fleschutz/PowerShell
|
|
.NOTES Author: Markus Fleschutz / License: CC0
|
|
#>
|
|
|
|
try {
|
|
$StartTime = Get-Date
|
|
|
|
write-progress "Reading Data/domain-names.csv..."
|
|
$PathToRepo = "$PSScriptRoot/.."
|
|
$Table = import-csv "$PathToRepo/Data/domain-names.csv"
|
|
|
|
foreach($Row in $Table) {
|
|
write-progress "Resolving $($Row.Domain) ..."
|
|
$Ignore = nslookup $Row.Domain
|
|
}
|
|
|
|
$Count = $Table.Length
|
|
$StopTime = Get-Date
|
|
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
|
|
$Average = [math]::round($Count / $TimeInterval.seconds, 1)
|
|
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($TimeInterval.seconds) seconds)"
|
|
exit 0
|
|
} catch {
|
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|