I wrote earlier about exporting DHCP reservations in Windows Server using netsh. Have a look at that post and follow the instructions to get the reservations from a full DHCP scope dump.
Having exported our DHCP reservations, we’ll now look at how to get netsh to help us recreate them in another scope, or on another server.
Assumptions: we dumped our scope (192.168.0.0) from a server PHOENIX1 on the domain bookgrub.edu.au, and we want to recreate those reservations in a scope (10.10.0.0) on a server PHOENIX2 on the domain bookgrub.local. We’ll be leaving the last two IP address fields the same, so 192.168.1.77 will be becoming 10.10.1.77.
To begin, we’ll need to open the text file that has our reservations and examine the contents. Helpfully, our netsh dump has outputted the full command syntax we’ll need to reimport the reservations. Here’s a sample line showing a reservation for a Sharp MX-450 photocopier, netbios name SharpMX450, able to be given both DHCP and BOOTP reservations:
Dhcp Server \\phoenix1.bookgrub.edu.au Scope 192.168.0.0 Add reservedip 192.168.0.21 001122aabbcc "SharpMX450" "Sharp MX-450 Photocopier" "BOTH"
With just a couple of quick steps followed, we’ll have all the reservations in our new scope in no time.
Our find command has dropped a couple of extraneous lines at the top of the text file, so delete them.
- Replace phoenix1 with phoenix2
- Replace bookgrub.edu.au with bookgrub.local
- Replace 192.168 with 10.10
That’s it for this example. Obviously, YMMV in practice. Your worst likely case, though, is probably only going to need to be manually changing reserved IPs in addition to the steps we’ve taken here. In most cases, you’ll want to retain the description and name of your reservations.
Save the file (in a different name if you want) and copy it across to your destination DHCP server. Open an administrative command prompt and CD into the directory you saved the file in (ours is called reservations.txt). Then run the command:
type reservations.txt | netsh
All being well, you just recreated all your DHCP reservations, with new IPs in a new scope on a new server in a new domain in maybe just a couple of minutes. Give yourself a pat on the back (mentally, so you don’t look stranger than usual) and move on with the next job.