List All DNS Records with Powershell

UPDATED 6/16/2016 Thanks for the comments!

Here’s a nice quick script to list all DNS records in each zone on the DNS server(includes sub-zones):

From the DNS Server

From a Remote DNS Server

From a Remote DNS Server (Output to Tab Delimited File)

 

6 thoughts on “List All DNS Records with Powershell

  1. Great short script. Thank you for posting it. May I recommend that you name your output file with the extension .CSV since you are exporting CSV data and add the “-ComputerName” parameter to both your Get-DnsServerZone and Get-DnsServerResourceRecord so that it can be run from anywhere not just from the DNS server itself.

    Anyway, thank you for your post

  2. It does not return any IP-addresses to CSV. If you run it without pipeing to anywhere, you can see IP-addressess though. Might be related the properities having sub-properties.

  3. Hello great script, but i have some long entry that when exported they appear like this:

    x._domainkey.cyberoffres TXT 0 00:05:00 k=rsa; p=DEW22WKEJRNLqXXX222DQ98ASDKKGNADCBi…

    Is there a way to export the complete character??

    Best regards

    • For futur generation 🙂 I got my solution here’s what i added

      $DNSServer = “servernameOrIp”
      $Zones = @(Get-DnsServerZone -ComputerName $DNSServer)
      ForEach ($Zone in $Zones) {
      Write-Host “`n$($Zone.ZoneName)” -ForegroundColor “Green”
      $Results = $Zone | Get-DnsServerResourceRecord -ComputerName $DNSServer | Format-Table -AutoSize -Wrap
      echo $Results > “$($Zone.Zo

Leave a Reply

Your email address will not be published. Required fields are marked *