How to set the replication scope of an AD-Integrat

2019-08-02 14:39发布

问题:

I need to use PowerShell to script the creation of some zones on Microsoft DNS Server (running on Windows Server 2008 R2); looks like there is no direct PowerShell support for managing the DNS server (yet), so WMI is the way to go.

I can create a new primary AD-integrated zone with this code:

$DnsZoneClass = ([WMIClass] "Root\MicrosoftDNS:MicrosoftDNS_Zone")
$DnsZoneClass.CreateZone("my.zone.name",0,$true)

The problem is, this automatically sets the replication scope of the new zone to "All domain controllers in this domain (for Windows 2000 compatibility)" and has no option for changing it.

How can I change this setting using WMI? I've been looking for a while at the documentation of the MicrosoftDNS_Zone class, but I wasn't able to find any way to do this.