Link to home
Start Free TrialLog in
Avatar of itbox
itboxFlag for United States of America

asked on

Creating a Secondary DNS Zone via WMI and C#

Hello everyone,
  What I am trying to do is create a secondary DNS Zone on my Secondary Name Server but I am a bit confused. I have a bit of code that will create Zones no problem (below).  The problem I am having is I am not seeing how to create a Secondary Zone and point it at the primary Name server.

I have taken a look at http://msdn.microsoft.com/en-us/library/ms682757(VS.85).aspx but there doesn't appear to be a property that is available that will allow me to do this? Any help would be greatly appreciated.

ManagementObject mc = new ManagementClass(_scope, new ManagementPath("MicrosoftDNS_Zone"), null);
                mc.Get();
                ManagementBaseObject params = mc.GetMethodParameters("CreateZone");
 
                params["ZoneName"] = zoneName;
                params["ZoneType"] = (UInt32)zoneType;
                params["DsIntegrated"] = 0; //false
                ManagementBaseObject zone = mc.InvokeMethod("CreateZone", params, null);

Open in new window

Avatar of Lofty Worm
Lofty Worm
Flag of United States of America image

The property may not exist.  I use WMI Code Creator to find the properties and values that are available, and for simple queries.

http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itbox

ASKER

That did it Chris, thanks.