Solved

Export all DHCP leases to text file - how?

Posted on 2010-11-17
4
12,778 Views
Last Modified: 2012-05-10
Hi all and thanks for your help in advance.

I am trying to get a list of all the address leases we have across multiple DHCP scopes in our environment.

When I run the below command it only gives me a list of the scopes but not the address leases within the scope.

netsh dhcp server show scope show clients > scopelist.txt

As we have over 60 scopes within our environment I do not want to have to go to each scopes address leases manually and select export list.

Can anyone suggest a script that will go through all the DHCP scopes and export the address leases into one master list?

Thanks
0
Comment
Question by:EUDS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Accepted Solution

by:
Dusan_Bajic earned 250 total points
ID: 34163626
This .bat should do the work:

For /F "skip=5 delims= " %%a IN ('netsh dhcp server \\dhcpservername show scope') DO (
	if not %%a == Total (if not %%a == Command netsh dhcp server \\dhcpservername scope %%a show clients >> %%a.txt)
)

Open in new window

0
 
LVL 6

Assisted Solution

by:ipajones
ipajones earned 250 total points
ID: 34206516
Add a "1" on the end of the netsh command to see detailed output i.e.

netsh dhcp server \\server_name scope scope_name show clients 1

Open in new window


You can also do the same in Dusan_Bajic's script to capture details of all scopes.
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 34421431
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question