Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check the DNS Settings for all Windows Servers
# Source:
# Could use error checking to not throw an alert when the server isn't accessible
$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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment