467,188 Members | 1,417 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,188 developers. It's quick & easy.

Query for current DHCP leases

Does anyone know if VB has an exposed API that can be used to query DHCP for
current address leases? I have seen threads that discuss DHCPObj.dll and
have successfully used it. However, this only exposed the server's
configuration, not the current address leases. I was also able to track
down an interface that is exposed to C, but 1.) already have a lengthy app
written in VB and 2.) don't know enough about C to write my own dll to do
this. Any ideas?
Nov 20 '05 #1
  • viewed: 13070
Share:
8 Replies
In article <u1*************@TK2MSFTNGP11.phx.gbl>, ri*******@dyncfg.com
says...
Does anyone know if VB has an exposed API that can be used to query DHCP for
current address leases? I have seen threads that discuss DHCPObj.dll and
have successfully used it. However, this only exposed the server's
configuration, not the current address leases. I was also able to track
down an interface that is exposed to C, but 1.) already have a lengthy app
written in VB and 2.) don't know enough about C to write my own dll to do
this. Any ideas?


Perhaps using WMI. See:

http://groups.google.com/groups?selm...66%40rwcrnsc53
&oe=UTF-8

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
Thanks for the info, however, this only gives me the information for the NIC
configuration, not the DHCP address leases. I have an average DHCP
environment in a mid-sized company... 2 servers and 18 subnets. I need to
be able to report the address lease information from the DHCP servers using
VB .NET 2003 to cross-reference with SMS and some other reporting tools.
Any ideas other than using C# or C++?

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <u1*************@TK2MSFTNGP11.phx.gbl>, ri*******@dyncfg.com
says...
Does anyone know if VB has an exposed API that can be used to query DHCP for current address leases? I have seen threads that discuss DHCPObj.dll and have successfully used it. However, this only exposed the server's
configuration, not the current address leases. I was also able to track
down an interface that is exposed to C, but 1.) already have a lengthy app written in VB and 2.) don't know enough about C to write my own dll to do this. Any ideas?


Perhaps using WMI. See:

http://groups.google.com/groups?selm...66%40rwcrnsc53
&oe=UTF-8

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 20 '05 #3
In article <#S**************@TK2MSFTNGP12.phx.gbl>, ri*******@dyncfg.com
says...
Any ideas other than using C# or C++?


Sorry -- no. Never worked at the server-side of DHCP stuff. Your DHCP
server doesn't have any built-in reports that give you lease
information?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #4
The DHCP MMC Console provides this information. However, almost every
environment I have worked in has multiple DHCP servers with multiple
subnets. The manual process that I'm currently performing is to pull this
data into a single "view" is to connect to each server using the DHCP MMC
Console and drill down into each subnet's | Address Leases and then do an
"export list" (standard MMC console feature thank goodness...). I save
these 36 csv files to the same folder with the same file name. I have an
Access database that I then open that has links to these csv files. The
Access database has only 1 local table. I run a Macro that runs a single
Delete query to empty out all of the old records from this table, then runs
36 Append queries (one for each linked csv file...), and then runs a Report
at the end that breaks down the information as it's correlated with data
from SMS, Domain Controllers, etc. What I'm trying to do is avoid the big
manual process of the MMC console "Export List" routine and the Access
database. I am trying to write a single VB .NET app that pulls the
information from the various places and generates a Crystal report. I can
pull off all of the data requests using ADO and ADSI except the DHCP Address
Leases. I have possibly found a C API call that can do his (there is of
course some way to access the data if the MMC console can do it, right!?).
However, I already have almost all of the app written in VB .NET and I'm not
a C expert. Any ideas?

-Rick Ford.


"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <#S**************@TK2MSFTNGP12.phx.gbl>, ri*******@dyncfg.com
says...
Any ideas other than using C# or C++?


Sorry -- no. Never worked at the server-side of DHCP stuff. Your DHCP
server doesn't have any built-in reports that give you lease
information?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 20 '05 #5
In article <uQ*************@TK2MSFTNGP12.phx.gbl>, ri*******@dyncfg.com
says...
I have possibly found a C API call that can do his (there is of
course some way to access the data if the MMC console can do it, right!?).
However, I already have almost all of the app written in VB .NET and I'm not
a C expert. Any ideas?


Is it a windows API that could possibly be called via PInvoke?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #6
Thanks for following up on this...

I apologize for my lack of experience in dealing directly with API calls...
what is PInvoke? I'm asking this to understand the root of your question...
in the meantime, I'll go research what PInvoke is and get more up to speed!
:)

-Rick Ford.

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <uQ*************@TK2MSFTNGP12.phx.gbl>, ri*******@dyncfg.com
says...
I have possibly found a C API call that can do his (there is of
course some way to access the data if the MMC console can do it, right!?). However, I already have almost all of the app written in VB .NET and I'm not a C expert. Any ideas?


Is it a windows API that could possibly be called via PInvoke?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 20 '05 #7
In article <eT**************@TK2MSFTNGP09.phx.gbl>, ri*******@dyncfg.com
says...
Thanks for following up on this...

I apologize for my lack of experience in dealing directly with API calls...
what is PInvoke? I'm asking this to understand the root of your question...
in the meantime, I'll go research what PInvoke is and get more up to speed!
:)


It's short for "Platform Invocation (or Invoke)". Look for "platform
invoke" in the .NET SDK documentation. It's a way for managed .NET code
to call into regular Win32 DLL's (such as Win32 API's).

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #8
Thanks for all your help! I'm also looking into C# / C++ .NET to VB .NET
convertors to also see if one of them will help.

-Rick Ford.

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <eT**************@TK2MSFTNGP09.phx.gbl>, ri*******@dyncfg.com
says...
Thanks for following up on this...

I apologize for my lack of experience in dealing directly with API calls... what is PInvoke? I'm asking this to understand the root of your question... in the meantime, I'll go research what PInvoke is and get more up to speed! :)


It's short for "Platform Invocation (or Invoke)". Look for "platform
invoke" in the .NET SDK documentation. It's a way for managed .NET code
to call into regular Win32 DLL's (such as Win32 API's).

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by andrew_webby at hotmail | last post: by
reply views Thread by Jack Black | last post: by
2 posts views Thread by Jack Black | last post: by
5 posts views Thread by Richard | last post: by
1 post views Thread by Screenbert | last post: by
reply views Thread by screenbert@gmail.com | last post: by
7 posts views Thread by =?Utf-8?B?VGhlTWFkSGF0dGVy?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.