I wanted to decommission some old Domain Controllers. I needed to make sure that other servers weren’t pointing to theses old DCs for DNS. I wrote this quick PowerShell script to loop through all servers and get their DNS search order.
$AllServers=Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*"} ForEach ($Server in $AllServers){ $Result=Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" -Property DNSServerSearchOrder -ComputerName $Server.Name $output = new-object PSObject $output | add-member NoteProperty "ComputerName" $Server.Name $output | add-member NoteProperty "DNSServerSearchOrder" $Result.DNSServerSearchOrder $output }
Hope that helps some one, or me when we moce to the next version of DCs.