Steve
Fri Sep 17 09:01:02 CDT 2004
I have had need for this type of information also. What I did was to dump
the information to a text file then parse the file as needed.
dhcpcmd <server_ip> enumclients <scope> -v
dhcpcmd 172.25.108.250 enumclients 172.25.100.0 -v >>C:\Working\dhcplease.txt
the dhcpcmd is from one of the server resource kits, sorry i do remember
whih one, but you can do site search for it at microsoft.
"GBrumby" wrote:
> Paul,
>
> I have taken my response verbatim (sorry) from another thread from a Paul
> too !......
>
> If you are asking about querying the DHCP server for information about
> scopes, exclusions etc... then yes you can.
>
> With Windows 2000 Server Resource Kit MS included the DHCPOBJS.DLL and .CHM
> (Documentation) which will allow you to access the DHCP server information.
> Not sure about a WINS equivalent (Microsoft perhaps may see this and tell us
> .... PLEASE ?????) DHCPOBJS is a nice teaser, but leaves us Scripters high
> and dry !!!!
>
> THE BIG GROAN is that whilst you can get the Scopes, Reservations and
> Exclusions, you CAN'T get access to the actual IP information for standard
> leases ! MICROSOFT PLEASE HELP as I really need to get this info myself
> mainly for MAC info to do WakeOnLan.
>
> If ONLY the IP addresses, machine names and MACs could be accessed via this
> I'd be happy happy happier !
>
> If you have a programming person around, they could look at
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dhcp/dhcp/dhcp_server_management_api.asp
> which is the Programming API information about querying DHCP Server Service
> for NT4, 2k and 2k3. A nice COM .OCX file would be appreciated ;-)
>
> For Windows 2003 Server, MS improved the WMI infrastructure to support this
> DHCP query (I believe WINS too). I don't have code to hand.
>
> Yevgen is right in indicating NETSH DHCP ..... (Note this is useful for WINS
> too !!!)
> as this certainly works for Win2k environments, however is NOT an elegant
> solution, albeit you can get the MAC for leases (note you don't get the
> Machine Names though !!!), as you have to trap the results and parse the
> output.... YUCK
> but workable....
>
> An example command line .....
> netsh dhcp server scope 192.168.1.0 show clients
> assuming the scope is 192.168.1.0 that is.....
>
> Clearly you have to know the scope before you make the query so in a big
> environment this may take some extra clever scripting, however that should
> give you the jist of things...
>
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/windowsserver2003/proddocs/datacenter/netsh_dhcp.asp
>
> Hope this helps...
> ......
>
> Further to this.....
> NETSH on 2k and 2k3 Server only ! You can't seem to do the same query on XP
> Pro , with even with 2k3 Admin tool kit installed ..... :-(
> Mind you that may be something to do with XPSP2 or something not sure....
>
> Regards
> Greg