Using PowerShell to view a list of DNS resource records

by Mitch Tulloch [Published on 28 Aug. 2013 / Last Updated on 28 Aug. 2013]

A tip on how you can use Windows PowerShell to view a list of DNS resource records.

To view a list of resource records of type A (address) in the corp.contoso.com zone, you can pipe the output of the Get-DnsServerResourceRecord cmdlet into the Where-Object cmdlet like this:

PS C:\> Get-DnsServerResourceRecord -ZoneName corp.contoso.com | Where-Object {$_.RecordType -eq "A"}
 
HostName         RecordType Timestamp            TimeToLive      RecordData
---------------         ----------          ------------------        -------------          -----------
@                           A           7/8/2012 12:00:00 PM 00:10:00        172.16.11.36
@                           A           7/8/2012 1:00:00 PM  00:10:00        172.16.11.232
DomainDnsZones   A          7/8/2012 12:00:00 PM 00:10:00        172.16.11.36
DomainDnsZones   A          7/8/2012 12:00:00 PM 00:10:00        172.16.11.232
ForestDnsZones   A          7/8/2012 12:00:00 PM 00:10:00        172.16.11.36
ForestDnsZones   A          7/8/2012 12:00:00 PM 00:10:00        172.16.11.232
sea-srv-1               A             0                                 01:00:00        172.16.11.232
SEA-SRV-5            A             0                                 01:00:00        172.16.11.36

Mitch Tulloch is a nine-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows administration, deployment and virtualization.  For more information see http://www.mtit.com. This tip was excerpted from his latest book Training Guide: Installing and Configuring Windows Server 2012 from Microsoft Press.

Featured Links