Check DNS Resolution using Powershell
##########################################################################################
#
# DNS-CHECK.PS1
#
##########################################################################################
$outfile = ".\results.txt"
$list = ".\LIST.TXT"
$names = Get-Content $list
$today = get-date
clear-host
write "==========================================================================="
write " $today"
write " Checking DNS Resolution"
write "$today" | out-file -encoding ASCII $outfile
foreach($name in $names) {
write "---------------------------------------------------------------------------"
write-host " $name"
try {[Net.DNS]::GetHostEntry($name) }
catch {
Write-host $server " ERROR: $name - NOT FOUND IN DNS"
"ERROR: $name - not resolved in DNS" | out-file -encoding ASCII $outfile -append
}
}#foreach server
write "==========================================================================="
#end
No comments:
Post a Comment