How to extract MAC address from DHCP reservations
netsh dhcp server dump >> reservationdump.txt
find “Add reservedip” reservationdump.txt >> reservations.csv
Updated June 26, 2012
Had another issue at work where I had to merge two DHCP scopes that divided a single segment between the scopes. Each scope controlled a range of IP addresses (Scope #1, .1 - .127, Scope #2, .128 - 254).
Both of the scopes had custom scope attributes defined.
One of the scopes had reservations defined.
To make matters more interesting, the subnet mask had to be changed from /25 (255.255.255.128) to /24 (255.255.255.0) - DHCP scope allows you to edit the defined range but the subnet mask is greyed out.
Lastly, a new scope had to be created under a new segment based on one of the old scopes above.
How to merge scopes without losing custom settings and re-doing reservations:
A variation of the commands at the start of this post will get you a text dump.
(Note there are two kinds of export data; binary and text and they are not interchangable)
If you need to quickly modify a scope on DHCP, eg, delete a scope and recreate all the reservations in a new scope, the above technique with the following steps will make it easier.
1. Export the scopes: netsh dhcp server dump >> dump.txt
2. Edit the exported file (you can safely delete the other non applicable scopes)
3. Import the exported file using this command: netsh exec c:\dump.txt
You may encounter these errors when you try to export DHCP server configuration (binary):
"An attempt was made to load a program with an incorrect format" - Hotfix solution from Microsoft
"Access denied" error message when you use the "netsh dhcp server import" - Binary Export/Import DHCP database steps
References:
Netsh commands for DHCP
Starting point for solution:
HOWTO: Import and Export DHCP reservations in server 2003
No comments:
Post a Comment