Solved

Adding DNS A Record on DNS Server

Posted on 2006-07-19
8
970 Views
Last Modified: 2010-08-05
Hi ,
Is it possible to interface with the DNS Server to create and delete A records? I am trying to create a utility that will create (A) Host records automatically using C#. I have read that it is possible with WMI.  Any information, help or examples would be greatly appreciated.
Regards
Srinivas
0
Comment
Question by:srinvask
  • 3
8 Comments
 
LVL 13

Expert Comment

by:devsolns
ID: 17141325
DNS's underlying storage mechanism is simply text files *.dns.  you can read them/edit them in notepad.  so in other words adding/editing/removing dns records is simply a matter of alterning these text files.  it maybe get a little more complicated if you have active directory intergrated dns.  If so the only thing different is there will be a serial number at the top that AD uses to ensure proper synchronization.  You'll need to increment this number by 1.  you'll find these files in the C:\[windows]\system32\dns\ folder.


-gp
0
 
LVL 13

Expert Comment

by:devsolns
ID: 17141334
To bring c# into this, System.IO.* should provide everything you need to do this.
0
 
LVL 8

Expert Comment

by:navalarya1982
ID: 17142259
are u interacting with DNS servers located remotely or is the application running in same machine as dns server ?
0
 

Author Comment

by:srinvask
ID: 17147690
No the application is running on a different machine.
0
 
LVL 13

Accepted Solution

by:
devsolns earned 500 total points
ID: 17148542
Here is a link to microsoft to download the WMI DNS resource kit.

ftp://ftp.microsoft.com/reskit/win2000/dnsprov.zip



DNS WMI Provider creates and populates WMI classes, which reference information contained in DNS zones and their resource records. The provider can be used to manipulate DNS servers, zones, and individual records. All necessary files are downloadable from the Microsoft FTP Site at ftp://ftp.microsoft.com/reskit/win2000/dnsprov.zip.

To install the provider, after extracting the content of the zip file, copy the dnsschema.mof to %systemroot%\system32\wbem\mof folder. The file should get automatically compiled and moved to the Good subfolder. Then copy the dnsprov.dll to the %systemroot%\system32\wbem folder and register it with the operating system by running: regsvr32 dnsprov.dll. You should get the confirmation of the successfull registration.

You can review the classes created by the MOF file compilation by either checking the documentation provided with the source files or by running any of the utilities included with WMI SDK (such as CIM WMI Studio) or WbemTest.exe, available on any computer with WMI installed (any Windows 2000 computer). DNS Provider populates a separate namespace in the WMI hierarchy - root\MicrosoftDNS. The namespace contains about 30 DNS related classes.

Along with the provider dll and MOF file, the downloaded zip file contains several VBScript examples, which allow you to accomplish most of the DNS related management tasks. For example, dnsserver.vbs can be used to:

- stop DNS server
cscript //nologo dnsserver.vbs stop

- start DNS server
cscript //nologo dnsserver.vbs start <

- restart DNS server
cscript //nologo dnsserver.vbs restart

- list DNS server configuration
cscript //nologo dnsserver.vbs LIST

- list zones on the DNS server
cscript //nologo dnsserver.vbs zone

- modify the configuration of the DNS server
cscript //nologo dnsserver.vbs modify

With dnszones.vbs, you can create, modify, add, delete, pause, update, resume, reload, and refresh DNS zones.
dnsrecord.vbs allows you to add, delete, modify, and list resource records
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

27 Experts available now in Live!

Get 1:1 Help Now