In a windows 2012 environment, I'm trying to construct a powershell command to create secondary zones on a dedicated DNS server, for all the active directory integrated primary zones on a domain controller (there are too many to do it manually in the GUI).
The Add-DnsServerSecondaryZone command seems to require a ZoneFile, and I can't figure out how to tell it to use AD integrated zones. I've gotten this far:
This doesn't work:
get-dnsserverzone -computername dc1.mydomain.net | where {("Primary" -eq $_.ZoneType) -and ("False" -eq $_.IsReverseLookupZone)} | add-dnsserversecondaryzone -computername ns1.mydomain.net -masterservers 10.x.x.x,10.x.x.x
And this doesn't work:
get-dnsserverzone -computername dc1.mydomain.net | where {("Primary" -eq $_.ZoneType) -and ("False" -eq $_.IsReverseLookupZone)} | %{ $_ | add-dnsserversecondaryzone -computername ns1.mydomain.net -masterservers 10.x.x.x,10.x.x.x -ZoneFile"$($_.ZoneName).dns"}
This is a tough one, please help.
Thanks
Bill
Bill Coulter