Page 1 of 1 1
Topic Options
#181075 - 2007-10-03 10:49 AM Enumerating IP settings via WMI
Leon Offline
Fresh Scripter

Registered: 2005-11-16
Posts: 5
I've bashed together a script that enumerates IP settings on either local or remote machines using WMI but I've come up against a small issue. I can only find how to retrieve 2 wins entries using WMI. However on the machines I'm querying there can be upto 4 entries.

I'm using Win32_NetworkAdapterConfiguration, WINSPrimaryServer & WINSSecondaryServer. Whereas with the DNS I'm able to use DNSServerSearchOrder to enumerate the whole list of entries.

So is there something similar for WINS? Or am I going to need to get this using some other method?

Cheers

Top
#181076 - 2007-10-03 11:01 AM Re: Enumerating IP settings via WMI [Re: Leon]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I'm unable to test because we do not use WINS but how about the GetIPOptions UDF? It should get the WINS servers but I’m not sure if it stops at two.

UDF Library » GetIPOptions() - Get/Determine IP Related Settings
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#181077 - 2007-10-03 11:12 AM Re: Enumerating IP settings via WMI [Re: Mart]
Leon Offline
Fresh Scripter

Registered: 2005-11-16
Posts: 5
Just tried that, but I'm afraid it too stops at 2 wins entries.

Taking a quick look at the GetIPOptions udf it looks like it too is retrieving the WINS using WINSPrimaryServer & WINSSecondaryServer from the same place in WMI as I am.

Top
#181078 - 2007-10-03 01:13 PM Re: Enumerating IP settings via WMI [Re: Leon]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
You can pull the information directly from the registry:

Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_{YOUR_INTERFACE_ID}
Value: NameServerList

You'll need to enumerate the interfaces and identify which one you are interested in.

Top
#181082 - 2007-10-03 01:41 PM Re: Enumerating IP settings via WMI [Re: Richard H.]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Right - my NicInfo UDF (posted by Doc as I recall) references this key. NicInfo enumerates all of the hardware NICs and returns an array of nic data arrays. Uses registry read and WMI where needed. Registry read is SO much faster than WMI for this!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#181084 - 2007-10-03 03:55 PM Re: Enumerating IP settings via WMI [Re: Glenn Barnas]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
http://www.scriptinganswers.com/Archive/...ndaryServer.htm
 Quote:

WMI only exposes the first and second WINS servers. The provider isn't designed to read more than those two because Microsoft never originally intended for a computer to be configured with more than two. Because WINS is considered legacy, the WMI provider that deals with it has never been updated to reflect a larger environment.

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.14 seconds in which 0.109 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org