DekGenius.com
[ Team LiB ] Previous Section Next Section

27.1 DNS Provider Overview

The WMI DNS provider was first released as part of the Windows 2000 Resource Kit Supplement 1, but unfortunately it was not ready for prime time. That version was buggy, did not include all the documented features, and in several cases behaved differently than what the documentation described. Also, since the DNS provider was included as part of a Resource Kit, it was not fully supported by Microsoft, which means that if you encountered problems, you were largely on your own. That said, much of the functionality you probably need is present in the Windows 2000 version, so it may be suitable. You can download the Windows 2000 DNS provider separately from the Resource Kit via FTP from the following location: ftp://ftp.microsoft.com/reskit/win2000/dnsprov.zip

With Windows Server 2003, the DNS provider is fully functional and supported. It is installed automatically whenever you install the DNS Server service. You can also install it separately as described in the next section. This may be necessary when doing development with the provider on a machine that does not have the DNS Server installed.

For our purposes, all sample code has been tested using the Windows Server 2003 DNS provider.

27.1.1 Installing the DNS Provider

You do not need to manually install the provider if you are installing the DNS Server service on a Windows Server 2003 server because it gets installed with the service.

If you downloaded the DNS provider files for Windows 2000 (dnsschema.mof and dnsprov.dll), you will first need to copy them to the %SystemRoot%\System32\wbem directory. Next, you'll need to compile the DNS managed object format (MOF) file by executing mofcomp filename from a command line. With Windows 2000, the DNS MOF file is named dnsschema.mof, and with Windows Server 2003 it is called dnsprov.mof. The output of the command should look like the following:

C:\WINDOWS\system32\wbem>mofcomp dnsprov.mof
Microsoft (R) 32-bit MOF Compiler Version 5.2.3628.0
Copyright (c) Microsoft Corp. 1997-2001. All rights reserved.
Parsing MOF file: dnsprov.mof
MOF file has been successfully parsed
Storing data in the repository...
Done!

The last step is to register the DNS provider DLL by executing regsvr32 dnsprov.dll from a command line. You should see a dialog box with the following:

DllRegisterServer in dnsprov.dll succeeded.

At this point you will be able to use the DNS provider from your scripts.

27.1.2 Managing DNS with the DNS Provider

The three main areas of interest when it comes to managing DNS include server configuration, zone management, and creation and deletion of resource records. The DNS provider has several classes to manipulate each of these components. With the MicrosoftDNS_Server class, you can manipulate server configuration settings, start and stop the DNS service, and initiate scavenging. The MicrosoftDNS_Zone class allows you to create, delete, and modify zone configuration. The MicrosoftDNS_ResourceRecord class and child classes provide methods for manipulating the various resource record types. Each of these will be explained in more detail in the next few sections.

Several additional classes are also supported by the DNS provider to manage other aspects of DNS, including the root hints (MicrosoftDNS_RootHints), DNS cache (MicrosoftDNS_Cache), and server statistics (MicrosoftDNS_Statistics). For more information on these classes, including sample scripts in VBScript and Perl, check out the following section in the MSDN Library (http://msdn.microsoft.com/library/): Networking and Directory Services Network Protocols Domain Name System SDK Documentation DNS WMI Provider

    [ Team LiB ] Previous Section Next Section