Re: Finding out how current DNS servers were set
From: Stig Sandnes (Sandnes_at_discussions.microsoft.com)
Date: 08/19/04
- Next message: Skybuck Flying: "Birth of multi-stream technology ?"
- Previous message: henghuei_at_yahoo.com: "Network Connection Check"
- In reply to: Jeroen van Bemmel: "Re: Finding out how current DNS servers were set"
- Next in thread: Jeroen van Bemmel: "Re: Finding out how current DNS servers were set"
- Reply: Jeroen van Bemmel: "Re: Finding out how current DNS servers were set"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Aug 2004 01:33:02 -0700
Thank you very much for your answer - this was exactly what I was looking for!
The only situation your method will not work, is when both the
"DhcpNameServer" and the "NameServer" lists are equal (except for the
separators). In this (admittedly contrieved) case, it would not be possible
to find out whether the current DNS setting is static or DHCP.
"Jeroen van Bemmel" wrote:
> You can read it from the registry at
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\XXX
> where XXX is the GUID of a network adapter.
>
> If you find a "DhcpNameServer" there it is set through DHCP. The
> "NameServer" entry is statically set using the GUI
> Note that when the strings contain multiple entries, the separators used are
> different (one has spaces, one commas)
>
> You can enumerate all DNS servers through IPHelper and check them against
> these lists
>
> "Stig Sandnes" <Stig Sandnes@discussions.microsoft.com> wrote in message
> news:3C8661AD-970B-449B-A088-FE116AF24DFA@microsoft.com...
> >I would like to programmatically detect whether the current DNS servers
> > associated with an interface have been statically set or whether they are
> > dynamically controlled by a DHCP server?
> >
> > I cannot fiond any way to query this information with the IP Helper API or
> > with the WMI Win32_NetworkAdapterConfiguration class. However, I can
> > detect
> > it with the netsh utility (typing "show dns" in the "interface ip"
> > context),
> > but parsing the text output is not an attractive option.
> >
> > Any suggestions? Thank you.
>
>
>
- Next message: Skybuck Flying: "Birth of multi-stream technology ?"
- Previous message: henghuei_at_yahoo.com: "Network Connection Check"
- In reply to: Jeroen van Bemmel: "Re: Finding out how current DNS servers were set"
- Next in thread: Jeroen van Bemmel: "Re: Finding out how current DNS servers were set"
- Reply: Jeroen van Bemmel: "Re: Finding out how current DNS servers were set"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|