PS - Get Server DNS Configuraiton

This post came about when I was decommissioning an existing DNS server and needed to find all Domain servers that had the server specified within its DNS settings.

First of all we dump all the information about the servers within the Domain out to a csv:

Get-ADComputer -Filter * -Property * | Select-Object Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion | Export-CSV Computers.csv -NoTypeInformation -Encoding UTF8

Now we can validate our list of machines and filter the ones we need within Excel. Once filtered to the desired result save a list in a file called servers.txt

Download Get-ServerDNS from

Then we need to run 

PS D:\NP\> .\Get-ServerDNS.ps1 -ComputerName (Get-Content -Path .\Servers.txt) | Format-Table Hostname,DNS -Wrap -Auto

And we have our list of configured DNS servers.