Solved

Export all DHCP leases to text file - how?

Posted on 2010-11-17
4
11,868 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
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 69

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now