Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, March 27, 2008 7:36 AM
Hi,
We want to query for the lease duration of a subnet scope on DHCP server remotely in our product. We don’t have clue from where we can read this information in case DHCP server is present on windows 2003 platform.
On windows 2000 server we read registry to find all the DHCP subnet information, but according to our research till now, that information is not present in registry if DHCP server is on windows 2003 platform.
Following things which we tried returned only half information.
1) DhcpGetSubnetInfo API returns only some information like subnet name, comment, and subnet mask. It doesn’t give other information like IP range and Lease duration.
2) We tried using COM (DHCPObjs) object (present in Windows 2000 resource toolkit). But it doesn’t give Lease duration.
Is there any other way to find Lease Duration either through Registry, WMI, dhcp.mdb(DHCP database) or any other source?
Any help would be appreciated. Thanks in advance.
~Somesh
All replies (2)
Wednesday, August 3, 2011 12:09 PM
Hi,
By using ipconfig /all cmd you should get the DHCP server ip address and Lease time. If you can run that cmd in a script and generate a report you could deploy that script using Group Policy.
Good Luck.
MCTS...
Wednesday, August 3, 2011 2:56 PM
In addition to Marius' suggestion, see if these help:
Dump DHCP Config Info:
netsh dhcp server dump >c:\DHCPinfo.txt
If migrating, then you can easily rebuild the DHCP server with the exported file:
netsh dhcp server import <full path of exported file> < all | ScopeList>
Show client leases for the 192.168.50.0 scope:
netsh dhcp server scope 192.168.50.0 show clients >c:\192_168_50_0_Clients.txt
Netsh commands for DHCP
http://technet.microsoft.com/en-us/library/cc787375(WS.10).aspx
Ace Fekay
MVP, MCT, MCITP EA, MCTS Windows 2008 & Exchange 2007 & Exchange 2010, Exchange 2010 Enterprise Administrator, MCSE & MCSA 2003/2000, MCSA Messaging 2003
Microsoft Certified Trainer
Microsoft MVP - Directory Services
Complete List of Technical Blogs: http://www.delawarecountycomputerconsulting.com/technicalblogs.php
This posting is provided AS-IS with no warranties or guarantees and confers no rights.