PowerShell – Get list of DNS records

Note: The cmdlet is available on Windows 2012 and 8 but can be used to query previous versions as well.

The below example has DNS zone as ‘Winplat.Net’

1. Get All the records:

Get-DnsServerResourceRecord -ZoneName WinPlat.net -ComputerName DNSSVR01

2. Get all the records of specific type (A, AAAA, CNAME)
Get-DnsServerResourceRecord -ZoneName WinPlat.net -ComputerName DNSSVR01 -RRType A
OR
Get-DnsServerResourceRecord -ZoneName WinPlat.net -ComputerName DNSSVR01 -RRType CNAME
OR
Get-DnsServerResourceRecord -ZoneName WinPlat.net -ComputerName DNSSVR01 -RRType AAAA

3. The code below lists all the DNS records which are registered dynamically (not static).

Get-DnsServerResourceRecord -ZoneName WinPlat.net -ComputerName DNSSVR01 -RRType A | where {$_.Timestamp -eq $null}