Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WMI for Querying "Obtain DNS Server Address Automatically"

125 views
Skip to first unread message

Joseph Morales

unread,
Feb 26, 2007, 3:11:18 PM2/26/07
to
Does WMI provide any way to query whether "Obtain DNS Server Address
Automatically" is set for a NIC?

I know that you can set the value in WMI by calling SetDNSServerSearchOrder
with no parameters. So you might think that you could just query
DNSServerSearchOrder and get back something empty or null if "Obtain DNS
Server Address Automatically" is set. But actually, DNSServerSearchOrder
returns the DNS addresses that are currently assigned, so you can't tell if
they were automatically assigned or manually assigned.

Thanks for any help.
--
Joseph Morales


Joseph Morales

unread,
Mar 2, 2007, 1:24:27 PM3/2/07
to
> Does WMI provide any way to query whether "Obtain DNS Server Address
> Automatically" is set for a NIC?

The only workaround I can find is a registry hack. First, you need to query
the GUID assigned to a particular NIC. To do this, read the SettingID
property of Win32_NetworkAdapterConfiguration. Then, read the following
registry value:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{GUID
value}\NameServer

This registry value is an empty string if "Obtain DNS Server Address
Automatically" is set for a NIC; otherwise it returns a DNS address.

--
Joseph Morales


0 new messages