Powershell and WMI.
PS C:\>Get-WMIObject -Namespace 'Root\MicrosoftDNS' -List
That will list the many different classes in the MicrosoftDNS namespace.
Want to get all resource records on the server?
PS C:\>Get-WMIObject -Namespace 'Root\MicrosoftDNS' MicrosoftDNS_ResourceRecord
Want to get only the A records?
PS C:\>Get-WMIObject -Namespace 'Root\MicrosoftDNS' MicrosoftDNS_AType
Want to get only the AAAA records?
PS C:\>Get-WMIObject -Namespace 'Root\MicrosoftDNS' MicrosoftDNS_AAAAType
Want to export all the A records to a CSV?
PS C:\>Get-WMIObject -Namespace 'Root\MicrosoftDNS' MicrosoftDNS_AType | Select OwnerName,RecordData | Export-Csv C:\Users\me\desktop\dns.csv -NoTypeInformation
Want to use a tab delimiter instead of a comma? Add -Delimiter "``t"
to Export-Csv. (Only one backtick in front of the t
... Stackexchange markdown can't handle my skillz.)
Want to get all the domains on the DNS server that are forward lookup zones only, and not Root Hints?
PS C:\>Get-WmiObject -Namespace 'Root\MicrosoftDNS' MicrosoftDNS_Domain | ? { $_.ContainerName -Notlike '..RootHints' -And $_.ContainerName -NotLike '..Cache' -And !$_.Reverse } | Select Name