This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: http://www.jbmurphy.com/2013/09/23/quick-powershell-script-to-check-dns-settings-on-all-servers/ | |
# 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 | |
$output |