Solved

Adding DNS A Record on DNS Server

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 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