Solved

Creating a Secondary DNS Zone via WMI and C#

Posted on 2009-06-30
3
924 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:itbox
3 Comments
 
LVL 11

Expert Comment

by:loftyworm
Comment Utility
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
0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
Comment Utility

It does exist. It's this one:

> [in, optional]  string IpAddr[],

Noted here:

http://msdn.microsoft.com/en-us/library/ms682760(VS.85).aspx

And should be a string array.

Chris
0
 

Author Closing Comment

by:itbox
Comment Utility
That did it Chris, thanks.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Learn about cloud computing and its benefits for small business owners.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now