Solved

Export all DHCP leases to text file - how?

Posted on 2010-11-17
4
11,405 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 68

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

21 Experts available now in Live!

Get 1:1 Help Now