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

**URL:** <https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574>\
**Category:** PowerShell Help\
**Created:** [October 29, 2018, 5:44am UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574 "2018-10-29T05:44:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![albertwt](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/albertwt/32/2550_2.png) [@albertwt](https://forums.powershell.org/u/albertwt)\
**Post date:** [October 29, 2018, 5:44am UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574/1 "2018-10-29T05:44:05Z")

</div>

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.

&nbsp;

Thank in advance.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [October 29, 2018, 7:15am UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574/2 "2018-10-29T07:15:42Z")

</div>

Hmmm … have you already searched for it?

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

What help do you expect/need?

---

<div class="post-metadata">

**Author:** ![albertwt](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/albertwt/32/2550_2.png) [@albertwt](https://forums.powershell.org/u/albertwt)\
**Post date:** [October 29, 2018, 8:43am UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574/3 "2018-10-29T08:43:53Z")

</div>

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

&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [October 29, 2018, 10:30am UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574/4 "2018-10-29T10:30:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [October 29, 2018, 10:38am UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574/5 "2018-10-29T10:38:41Z")

</div>

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](https://4sysops.com/archives/using-powershell-implicit-remoting/) as well.

---

<div class="post-metadata">

**Author:** ![albertwt](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/albertwt/32/2550_2.png) [@albertwt](https://forums.powershell.org/u/albertwt)\
**Post date:** [October 29, 2018, 8:56pm UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574/6 "2018-10-29T20:56:40Z")

</div>

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

Thanks all for the sharing and the solutions.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:33pm UTC](https://forums.powershell.org/t/exporting-dns-console-to-csv-file-using-powershell-or-any-means-necessary/11574/7 "2024-05-16T20:33:47Z")

</div>

Closed on May 16, 2024, 8:33pm UTC


