The SetDynamicDNSRegistration method of the Win32_NetworkAdapterConfiguration WMI class does not work as expected in Windows XP (834440)



The information in this article applies to:

  • Microsoft Windows XP Professional
  • Microsoft Windows XP Home Edition

Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

In Microsoft Windows XP, the SetDynamicDNSRegistration method of the Win32_NetworkAdapterConfiguration Windows Management Instrumentation (WMI) class does not work as expected. For example, when you use the SetDynamicDNSRegistration method to configure settings for the dynamic registration of IP addresses by using DNS on the network adapter, the settings are not configured as expected.

CAUSE

This problem occurs because the SetDynamicDNSRegistration method does not modify the correct registry settings. In Windows XP, the DNS registration settings are stored in the RegistrationEnabled registry entry and in the RegisterAdapterName registry entry in the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\<NetworkAdapterGUID>

Instead of modifying these two registry entries, the SetDynamicDNSRegistration method creates two new registry entries, DisableDynamicUpdate and EnableAdapterDomainNameRegistration.

RESOLUTION

To resolve this problem, obtain the latest service pack for Windows XP. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

322389 How to obtain the latest Windows XP service pack

WORKAROUND

To work around this problem, use the following script to modify the registry and configure the DNS registration settings in Windows XP:
'On Error Resume Next

Const FULL_DNS_REGISTRATION =True
Const DOMAIN_DNS_REGISTRATION = False

strComputer = "."
Set objWMILocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMICimService = objWMILocator.ConnectServer(strComputer, "root\cimv2")

Set colOS = objWMICimService.ExecQuery("Select * from Win32_OperatingSystem")

For Each objOS in colOS

	if ( InStr(1, objOS.Caption, "XP", vbTextCompare) > 0 ) Then
	
		isWinXP = true
	else
		isWinXP = false
	End if		

Next

Set colNetCards = objWMICimService.ExecQuery  ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objNetCard in colNetCards

	if (isWinXP) Then
	
		retVal = SetAdapterInfoInRegistry(objNetCard.SettingID)
	Else
	
  		retVal = objNetCard.SetDynamicDNSRegistration (FULL_DNS_REGISTRATION, DOMAIN_DNS_REGISTRATION)
	End if
Next

if retVal <> 0 then
	Wscript.Echo "Error Setting Dynamic DNS Registration.Error Number: "  & retVal
Else
	Wscript.Echo "Successfully Changed the required settings!"
End if
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, visit the following Microsoft Web site:For additional information about the support options available from Microsoft, visit the following Microsoft Web site:

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in Windows XP Service Pack 2.

MORE INFORMATION

For more information about the SetDynamicDNSRegistration method of the Win32_NetworkAdapterConfiguration class, visit the following Microsoft Web site:

Modification Type:MajorLast Reviewed:3/10/2006
Keywords:kbnetwork kbfix kbBug KB834440 kbAudDeveloper kbAudITPRO