Search code examples
.netpowershellactive-directorydnswmi

How to change the replication scope of an Active-Directory-integrated DNS zone?


Related to this question: How to set the replication scope of an AD-Integrated DNS zone using WMI?.

I need to change (using PowerShell, so .NET, ADSI or WMI) the replication scope of an Active-Directory-integrated DNS zone, i.e. the directory partition the zone it's stored in (DomainDnsZones or ForestDnsZone).

Can this be accomplished programmatically?


Solution

  • When either the GUI or DNSCMD is used to change the replication scope of a zone, I've observed the following process:

    1) All of the DNS record objects are copied from the old location to the new location.

    2) If (and only if) the copy completes successfully, the objects in the old location are deleted. I observed one case where the process was interrupted, leaving a partial copy of the zone in the new location. It caused some problems because the DNS service did not like seeing two versions of the same zone in different locations.

    I'm not even sure it is that simple. For instance, are changes tracked during the copy process? My guess is no. Consider replication partners who don't know about the change yet: They will still continue to update the zone in the old partition until the DNS service detects that the zone has moved.

    So, if you can use ADSI to copy all of the DNS zone objects from the old partition to the new partition, then delete the objects from the old partition, that should do the trick.

    Thus, while it is possible, it is not exactly simple. Even with all the ADSI scripting I've done, I think I would still defer to DNSCMD or the GUI for this task.