Exporting DNS console to .CSV file using PowerShell or any means necessary?

Welcome Forums General PowerShell Q&A Exporting DNS console to .CSV file using PowerShell or any means necessary?

This topic contains 5 replies, has 4 voices, and was last updated by

 
Participant
9 months, 3 weeks ago.

  • Author
    Posts
  • #119599

    Participant
    Topics: 16
    Replies: 17
    Points: 141
    Rank: Participant

    Hi All,

    Using Windows Server 2012 R2 and Windows Server 2012 DNS console or PowerShell,

    I need to export the list of DNS forward lookup zones and also the Conditional forwarders in my DNS Management console to .CSV so I can compare it between two DNS server in different AD domains.

    Any help and suggestion would be greatly appreciated.

     

    Thank in advance.

  • #119608

    Participant
    Topics: 1
    Replies: 1472
    Points: 2,324
    Helping Hand
    Rank: Community Hero

    Hmmm ... have you already searched for it?

    https://docs.microsoft.com/en-us/powershell/module/dnsserver/get-dnsserver?view=win10-ps

    What help do you expect/need?

  • #119625

    Participant
    Topics: 16
    Replies: 17
    Points: 141
    Rank: Participant

    When I execute the below script:

    $DNSServer = "servernameOrIp"
    $Zones = @(Get-DnsServerZone -ComputerName $DNSServer)
    ForEach ($Zone in $Zones) {
    Write-Host "`n$($Zone.ZoneName)" -ForegroundColor "Green"
    $Results = $Zone | Get-DnsServerResourceRecord -ComputerName $DNSServer
    echo $Results > "$($Zone.ZoneName).txt"
    }

    I get the error:

    Get-DnsServerZone : The term 'Get-DnsServerZone' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:2 char:12
    + $Zones = @(Get-DnsServerZone -ComputerName $DNSServer)
    + ~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Get-DnsServerZone:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

     

  • #119676

    Moderator
    Topics: 0
    Replies: 29
    Points: 283
    Team MemberHelping Hand
    Rank: Contributor

    Have you installed the DNSServer PowerShell module on your local machine (or the machine you're running the command on)?

    It it likely to be in the Windows RSAT, if you haven't.

  • #119685

    Senior Moderator
    Topics: 8
    Replies: 1004
    Points: 3,253
    Helping Hand
    Rank: Community Hero

    DNSServer module comes when the feature is enabled, make sure its enabled otherwise, as mentioned above you can make use of RSAT or you can use implicit remoting as well.

  • #119872

    Participant
    Topics: 16
    Replies: 17
    Points: 141
    Rank: Participant

    OK, It seems the remoting is working great for me.

    Thanks all for the sharing and the solutions.

The topic ‘Exporting DNS console to .CSV file using PowerShell or any means necessary?’ is closed to new replies.