May 27th, 2015

Чудеса в DNS

Столкнулся с "чудесами": рабочие станции случайным образом не регистрируют/обновляют DNS-записи на домен-контроллере.

Первым делом - диагностика.
Воспользуемся "eine wundere powershellische Komandleten"

cls
write-host FLushing DNS cache...
ipconfig /flushdns
write-host
$total_workstations_count = (Get-ADComputer -Filter {(dnshostname -like "*workstation*") -or (dnshostname -like "*notebook*")} | sort dnshostname | format-table dnshostname).count
write-host "$total_workstations_count" workstations total found in Active Directory
write-host -----------------------------------
write-host Trying to resolve DNS host names...
$lost_workstations = 0
$workstations = (Get-ADComputer -Filter {(dnshostname -like "*workstation*") -or (dnshostname -like "*notebook*")} | sort dnshostname)
foreach($workstation in $workstations) {
$workstation_dns = $workstation.dnshostname | Select -Expand $_.dnshostname
If (-not(Resolve-DnsName -Name $workstation_dns -ErrorAction SilentlyContinue)) {
Write-Output -Verbose "Warning!!! Unregistred workstaion: $workstation_dns"
$lost_workstations ++
}}
Write-Host "Total workstations NOT registred: $lost_workstations"
write-host ----------- End Of Script ---------

_