Home All Groups Group Topic Archive Search About

Getting number of DCHP Leases with WMI



Author
15 Mar 2007 6:29 PM
Steven
Does anyone know if it is possible to obtain the number of current DHCP
leases using WMI?  I can't find any info on this so far and there is no DHCP
object listed in my WMI namespace list.

Also, I'd like to be able to get a count of Computer and Domain Controller
objects from the AD (this may actually be easier).

Author
19 Mar 2007 6:51 AM
bg
On Mar 15, 1:29 pm, "Steven" <sdi***@247networks.ca> wrote:
> Does anyone know if it is possible to obtain the number of current DHCP
> leases using WMI?  I can't find any info on this so far and there is no DHCP
> object listed in my WMI namespace list.
>
> Also, I'd like to be able to get a count of Computer and Domain Controller
> objects from the AD (this may actually be easier).

I don't think that you can get it with WMI.  You might try using netsh
to do it.

You can bind to the domain using ADSI with something like this:

oDomain = GetObject("WinNT://domain")
Author
21 Mar 2007 3:26 AM
Steven
I think you are correct (no WMI MOF [interface] for dhcp service),
apparently you can custom build one for extracting data from the registry
though (will find some time between now and the end of time to look into
this further).
I'll do reading on the netsh command line tool over the next week or two to
see if I can use it.

Does anyone know if the lease list is stored in a locally
accessible/readable file somewhere?

All I want is to know the total number of DHCP leases issued by all the DHCP
servers.
As in:
Server1: 5 leases
Server2: 13 leases
Total: 18 Leases

I don't need any other info and don't need to make any changes, etc.  I'm OK
with running a script once per server too.

Come to think of it, would this info be stored in the AD somewhere (after
all the DHCP server is authorized there)?  I doubt it is but maybe someone
may have gone down this path before and found a way to do this already.

Show quote
"bg" <bryang***@gmail.com> wrote in message
news:1174287119.723066.232680@n76g2000hsh.googlegroups.com...
> On Mar 15, 1:29 pm, "Steven" <sdi***@247networks.ca> wrote:
>> Does anyone know if it is possible to obtain the number of current DHCP
>> leases using WMI?  I can't find any info on this so far and there is no
>> DHCP
>> object listed in my WMI namespace list.
>>
>> Also, I'd like to be able to get a count of Computer and Domain
>> Controller
>> objects from the AD (this may actually be easier).
>
> I don't think that you can get it with WMI.  You might try using netsh
> to do it.
>
> You can bind to the domain using ADSI with something like this:
>
> oDomain = GetObject("WinNT://domain")
>
Author
19 Mar 2007 3:19 PM
Tyler Larson
"Steven" <sdi***@247networks.ca> wrote in message
news:12vj44h5mrta2cd@corp.supernews.com...
> Does anyone know if it is possible to obtain the number of current DHCP
> leases using WMI?  I can't find any info on this so far and there is no
> DHCP object listed in my WMI namespace list.
>
> Also, I'd like to be able to get a count of Computer and Domain Controller
> objects from the AD (this may actually be easier).

Hows about win32_networkadapter or win32_networkadapterconfiguration? Those
will give you just about everything there is to know about your network
interfaces and their configuration.

AddThis Social Bookmark Button