?
Solved

Export all DHCP leases to text file - how?

Posted on 2010-11-17
4
Medium Priority
?
13,141 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 1000 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 1000 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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