Recipe 13.3. Modifying DNS Server ConfigurationProblemYou want to modify DNS Server settings. This will be one of the first things you need to do after installing DNS Server. SolutionUsing a graphical user interface
Using a command-line interfaceWith the following command, replace <Setting> with the name of the setting to modify and <Value> with the value to set: > dnscmd <ServerName> /config /<Setting> <Value> The following command enables the EnableDnsSec setting on dns01: > dnscmd dns01 /config /EnableDnsSec 1 The following command disables the NoTcp setting on the local host: > dnscmd /config /NoTcp 0 The following command sets the DsPollingInterval setting to 60 on dns02: > dnscmd dns02 /config /DsPollingInterval 60 For the complete list of settings, run dnscmd /config from the command line. Using VBScript' This code shows how to set a DNS Server property. strServer = "<ServerName>" set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS") set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""") objDNSServer.<Setting> = <Value> ' e.g., objDNSServer.AllowUpdate = TRUE objDNSServer.Put_ ' This code displays all the settings on a DNS Server. ' ------ SCRIPT CONFIGURATION ------ strServer = "<ServerName>" ' e.g., dns1.rallencorp.com ' ------ END CONFIGURATION --------- ' Instantiate a WMI object for the target server set objDNS = GetObject("winmgmts:\\" & strServer & "\root\MicrosoftDNS") ' Get an instance of the MicrosoftDNS_Server class set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""") ' Iterate over each property using Properties_ Wscript.Echo objDNSServer.Properties_.Item("Name") & ":" for each objProp in objDNSServer.Properties_ if IsNull(objProp.Value) then Wscript.Echo " " & objProp.Name & " : NULL" else if objProp.IsArray = TRUE then for I = LBound(objProp.Value) to UBound(objProp.Value) wscript.echo " " & objProp.Name & " : " & objProp.Value(I) next else Wscript.echo " " & objProp.Name & " : " & objProp.Value end if end if next DiscussionUsing a graphical user interfaceDNS Server supports a variety of settings to configure everything from scavenging and forwarders to logging. With the DNS snap-in, the settings are spread over several tabs in the Properties property page. Using a command-line interfaceYou can get a list of available settings, many of which can't be configured from the DNS snap-in, by running dnscmd /config from a command line. For the CLI and VBScript solutions, the setting names are nearly identical. Be careful when using the dnscmd /config command because very little error checking is done on the values you specify. Each setting is stored in the registry on the DNS Server under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters key. The dnscmd /config command simply writes the value you specify to a registry value and does not verify if the input is valid. See the following web site for more information on what values are expected for each setting: http://msdn.microsoft.com/library/en-us/dns/dns/microsoftdns_server.asp. Using VBScriptBe sure to call the Put_ method after you finish configuring settings in order for the changes to be committed to the server. See AlsoMSDN: MicrosoftDNS_Server |