The Export-DnsServerZone doesn't seem to like accepting a variables:
(not running this script on the actual DC, I am running it from
another Win2012 R2 server, and pointing it at a DC)

-------------------------------------
$DNSServer = Get-DnsServer -ComputerName <servername>
$AllZones = $DNSServer.ServerZone

ForEach ($Zone in $AllZones)
{
  IF ($Zone.IsReverseLookupZone)
  {
  $MyZone = $Zone.ZoneName
  $MyZoneFileName = "c:\windows\system32\dns\backup\" + $Zone.ZoneName + ".TXT"
  Export-DnsServerZone -ComputerName <servername> -Name $MyZone
-Filename $MyZoneFileName
  }
}
------------------------------------

Export-DnsServerZone : Failed to export the zone content for
0.in-addr.arpa on server <servername> to the file
c:\windows\system32\dns\backup\0.in-addr.arpa.TXT.
At P:\software\PHA Scripts\AD related
scripts\Save-all-DNS-zones-and-records.PS1:17 char:3
+         Export-DnsServerZone -ComputerName <servername> -Name $MyZ ...
+    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument:
(0.in-addr.arpa:root/Microsoft/...S_DnsServerZone)
[Export-DnsServerZone], CimException
    + FullyQualifiedErrorId : WIN32 9611,Export-DnsServerZone


So what's up with that? What is wrong here? I saw posts about using
"..\..\..\" as relative path in the export filename, but that doesn't
work either.

Am I just missing something simple?


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to