$DnsServers = @(
"10.191.11.4",
"10.191.11.5",
"ru-dc-p03.sys.clz.ru"
)
$Hosts = @(
"delivery.clz.ru",
"stage-delivery.clz.ru"
)
foreach ($Dns in $DnsServers) {
Write-Host "`n===== DNS: $Dns =====" -ForegroundColor Cyan
foreach ($HostName in $Hosts) {
try {
Resolve-DnsName `
-Name $HostName `
-Server $Dns `
-Type A `
-DnsOnly `
-ErrorAction Stop |
Where-Object { $_.Type -eq "A" } |
Select-Object @{
Name = "DNS"
Expression = { $Dns }
}, Name, IPAddress, TTL |
Format-Table -AutoSize
}
catch {
Write-Host "ERROR: $HostName : $($_.Exception.Message)" -ForegroundColor Red
}
}
}