Solved

Adding DNS A Record on DNS Server

Posted on 2006-07-19
8
966 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

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

9 Experts available now in Live!

Get 1:1 Help Now