How to duplicate reservations from one server to another?

The problematic scenario is the following:

There are two DHCP servers serving the same set of subnets. For each of the subnets which is being served by both the servers there are two scopes one for each server. The scopes are configured in a way that the active address range in one is in the exclusion range of the other. This way we make sure that a particular IP address is not distributed independently of each other. Now there is a small problem if there are reservations. If the admin has configured the reservations in only one of the scopes then he is on for a surprise. The surprise is that the client for whom you have configured the reservation might get a dynamic IP address from the other DHCP server. This can happen in case the DISCOVER sent by the client reaches the server which does not have reservations first. Thus the essential reason for having a reservation is defeated.

The proper way to handle this scenario is: First configure the scope such that the active address range for both the DHCP servers in question is mutually exclusive. Then write a netsh script for the reservations. This script file (let’s call it reservations.txt) would contain for each reservation an entry like:

dhcp server scope add   reservedip <MAC ADDRESS>

Now run this script in the first server by typing:

Netsh exec reservations.txt

After this has been done, you might want to use a word processor to replace the IP address of the server to the IP address of the second DHCP server (say

Once this replacement has been done, you can run the script in the second server. Actually the scripts for both the servers can be run from any place from which there is network connectivity to the DHCP servers. This is because almost most of the operations done through netsh is remotable.

Now for the tough part. If you do have two scopes like what I have mentioned and you did not duplicate the reservations then you have to do the following:

On the DHCP server where you have configured the reservations, you can execute this command for each of the scopes from which you need to export the reservations.

netsh dhcp server <serverIPAddress> scope <scopeAddress>  dump>dump.txt

This will dump all the configuration settings for this scope. At the bottom of the dumped text file, you can see the reservations being dumped. Just copy this reservation settings to a new file say “exportedreserv.txt”.

Append to this file exportedreserv.txt the reservation settings from each of the other scopes.

Now on the target machine, do a

netsh exec exportedreserv.txt

You should be done by now. I know it is not completely automatic, but it does save a lot of effort.

If you have any questions please ask me. And also try to leave some comments (I know this is moderated) as I would like to know if this blog has any takers.


Comments (50)

  1. James says:

    Thank you!

  2. Gary Pullis says:

    Thanks! This is exactly what I needed to know.

    Now, all you guys have to do is find a way of replicating configuration information using AD and you’ll have an enterprise DHCP solution. 😛

    Seriously, I know that replicating leases would be impractical and dealing with server specific stuff like who has which scopes which exclusions within those scopes would be tricky to write a GUI for. Still, it’s a dream I have. 🙂

    Still. Getting to use netsh replicate this stuff is far better than doing it by hand. Thanks very much.

  3. Vin says:

    Excellent! I’ve been looking all over for how to do this. We have many reservations and the thought of manually creating them twice was making me ill. 😉

  4. Oli Dewdney says:

    AD replication ( like DNS ) sounds like the way forward! Is this being considered?

  5. Palle Grassmé says:

    Awesome!! Just Awesome! I’ve been playing around with Netsh for quite awhile and haven’t found the right way, but this really works GREAT. My use is for consolidating several domains including their services, and this is COOL. Please post more like this.

    Thankx alot, Palle

  6. Chris H says:

    I just finished moving reservations from one server to three others and then stumbled upon this page. Luckily I did use netsh but a little differently.

    I just wanted to add that you can create a batch file to just run these commands, just add "netsh" in front for each line and you’re good! This is particularly useful if you needed to replicate to multiple servers, just copy and paste your reservations and change the server address, run batch file and done!

  7. Jonathan says:

    Thanks a lot! This really cleaned up my operation, and stopped me from having to manually copy all my reservations.

  8. Mark M. says:

    Thanks for this write-up, well written.

  9. Eric N says:

    Thank you for your write-up. This tool youhave shown is FAR more useful than you showed though.

    I needed to change the subnet mask for 4 of my scopes and retain the existing reservations Using the export: netsh dhcp server <serverIPAddress> scope <scopeAddress> dump>dump.txt

    I then edited the .txt file to replace the subnet mask and then imported the scopes one at a time. This allowed me to move 3 split scope servers to a clustered dhcp server while changing the subnet mask in less than 2 hours. (less than 1 hour if you count all the time I spent looking for a solution – lol).

    Anyway, your blog was a GREAT help and it is unfortunate that the information you have here isn’t better publicised.

  10. Justin says:

    Awesome! Has anybody written a front end to simply this process for administration yet? It just seems that it may be easier from a lot of users to use a GUI, rather than writting a script every time. This is especially try when you are adding reservations frequently. The closest we’ve found is Men & Mice, but it falls very short of multiple server administation under a single scope.

    Thanks for the information!

  11. David says:

    Thanks a lot for having raised this trick to my attention… I was using netsh throught complicated vb scripts previously…

    Is it possible to use it remotely ? I have tried "netsh -r servername options" but it failed. Thanks.

  12. anto_rocks says:

    @David, when you want to configure a remote DHCP server all you have to do is put the remote DHCP server name after the "server" keyword.

    Eg: netsh dhcp server \remote-machine add scope …

    or you can put the IP address also

    netsh dhcp server add scope …

  13. Alex says:


    Is it possible to use this solution to import dhcp reservations from a text file rather than exporting them from another server?

    I would like to create a spreadsheet with client names and corresponding ip reservation, then export this to a text file and import in into dhcp on a windows 2003 server.


  14. Shabu Itty says:

    Hi AJ,

    I would like to automatically schedule to get the dhcp reservation list in excel format on a monthly basis.  Could you please direct me to achive this.


  15. Shabu Itty says:

    Hi AJ,

    I would like to automatically schedule to get the dhcp reservation list in excel format like the way we export into csv format from Windows on a monthly basis.  Could you please direct me to achive this.


  16. rape stories says:

    Your article is prety nice. It’s a pity that i didn’t see it more later.

  17. Vila says:

    Thank you man. I am impressed.

  18. Brian says:

    I am trying to duplicate the reservations on another DHCP server in a DR site.  The plan is to have clients send requests to both servers, but only have the production DHCP server running to answer these request.  In case of a catastrophic failure, we would manually turn on the DHCP service in the DR site.  Currently both the production site and the DR site are running Windows 2003 Server in a clustered environment.  Both clusters are on seperate subnets.  We are using DoubleTake to replicate the data.


  19. DukeBox says:

    To make it fully automatic,

    you only need a command line find/replace tool (search teh web)

    netsh dhcp server <serverIPAddress> scope <scopeAddress>  dump|find "reserved"|fr <old_serverIPAddress> <new_serverIPAddress>>dump.txt

    You can figure out the rest.

  20. Abie says:

    i don’t understand bout your explaint. can you more spsific again.

  21. Pers says:

    Thank you!

    you saved me about 8 hours of typing with reservations in 3 different scopes on 5 servers

  22. Stew says:

    Thanks for this – we had also neglected to duplicate reservations between DHCP servers and this saved many hours of tedious work.

    Great tip!

    Now if MS can just make this stuff replicate somehow like DNS does…   😉

  23. Brett says:

    Thank you so much! This rocks!

  24. anup says:

    please give me the procedure for duplication dhcp resevations from one server to another

  25. George Nash says:

    I needed to add the netbios name as a name for the reservation, so adding E-01 to the end of the string you gave added the netbios name of E-01 to the reservation. Thanks for the great tip, saved me hours of work

  26. Larry says:

    This is a great article and it is making me think that I have a problem with the way that I am planning to rollout DHCP services. We are collapsing 4 NT 4 DHCP servers into 2 centralized Win2K3 DHCP servers using 50 / 50 scope allocation. I was planning to setup the scopes as you indicated.

    >For each of the subnets which are being served by both the servers there are two scopes one for each server. The scopes are configured in a way that the active address range in one is in the exclusion range of the other. <<

    But you bring up this issue of reservations, which I had not thought of. What do you mean by “First configure the scope such that the active address range for both the DHCP servers in question is mutually exclusive.” Can you provide an example?

  27. Amanda says:

    Thanks!  This got me started doing more resarch on netsh and I found a way to fully automate this process with a batch file and 2 free utilities (grep.exe and sed.exe)  In my environment I was worried about 2 dhcp servers getting out of sync.  So this script will purge all reservations from the 2nd server every night, and import the reservations from the 1st server.  Maybe someone else will find it useful.

    REM #– Dump current DHCP configurations –#

    netsh dhcp server \server1 dump > dhcp_dump.txt

    netsh dhcp server \server2 dump > dhcp_purge.txt

    REM #– In the purge file, pull out the reservation details and change "add" to "delete" –#

    grep reservedip dhcp_purge.txt | sed.exe "s/Add/delete/" > dhcp_purge-reservations.txt

    REM #– Purge reservations on the second dhcp server –#

    netsh exec dhcp_purge-reservations.txt

    REM #– In the dump file pull out the reservation details and change server IPs. –#

    grep reservedip dhcp_dump.txt | sed.exe "s/<server1 IP>/<server2 IP>/" > dhcp_new-reservations.txt

    REM #– Import the new reservations into the second dhcp server –#

    netsh exec dhcp_new-reservations.txt

  28. James says:

    is an automated VBS that can replicate / copy and sync DHCP reservations

  29. freealx says:

    Great article – KISS method (Keep It Simple Stupid)

    The above mentioned "automated VBS" is noting more then front end for shell commands to netsh. Very heavy and with many errors.

    This solution is the best one 🙂

  30. Damon Young says:

    I have been trying to figure out how to do this for years.  "There MUST be a way to do this," I kept muttering to myself as I re-entered all those reservations manually.  Each time I had to do it I regretted not putting more time into figuring this out.  Thank you.  Thank you.  Thank you.

  31. Tom Woods says:

    Thanks for the info, AJ… Saved me some time, and more importantly hassle!


  32. Khurram Farhan Hassan says:

    What a superb piece of information. So simple yet incredily useful. Thanks man.

  33. OZ says:

    Even after almost four years a very useful and much appreciated article. Thanks a lot!

  34. ThomMck says:

    Just wanted to say thanks.

    I created a dump file from my test DHCP server (running in HyperV)

    I then just modified the file to include only what I needed, plus new additions, and it worked a treat.

    A real time saver, THANK YOU

  35. Jim Geidl says:

    Here’s a scenario; I have two servers, the primary server has DHCP running on it and the backup server also has DHCP installed but the sevvice has been stopped.  The second server is configured identically to the primnary server as far as scope configuration but not reservations.  I create a dumplease file from the primary server use rmanage with the -dumplease switch and store it on the backup server for use in case of a failure with the primary server.  Here is how I envision this working:

    Primary server fails

    Start DHCP service on backup server

    Run rmanage with -makereservation switch pointing to the stored backup file from the primary server.

    Will this work?


  36. Jim Geidl says:

    Never mn9ind; tried it and it doesn’t work.

  37. Mike McHale says:

    I tried it and it worked a treat.


  38. Jim Geidl says:


    You tried it the way I suggested on May 7 and it worked??  I tried it and nothing came into the scope from the dumplease file.  Will you give me some details on EXACTLY what you did?  This would be a wonderful way of always having a DHCP backup ready.  Next to auto-fail-over this is about the best I have seen…if I can get it to work.


  39. Steve Owsley says:

    Thanks A.J.

    I encourage those I work with to have two DHCP servers, both running all the time.  As A.J said have mutually exclusive scopes.  such as:

    Server 1 – 3.254 /16

    Server 2 – 4.254 /16

    For complete network design, consider

    10.a.b.c/16, where a=site, b=device, c=netid

    2nd octet is the sites (a)

    3rd octet are for devices (b)

       0 = network devices (switches, rtrs, etc.)

       1 = servers

       2 = printers

       3 = DHCP clients from server 1

       4 = DHCP clients from server 2

       5 = phones

       6 = wireless

       7 = open

       8 = RAC (remote access card for servers in .1.x)

      xx = etc.

    For example, default gateway  Domain controllers and, both DNS, WINS, and DHCP.

    We have a current situation where some older jetdirects are losing their config and getting DHCP addresses.  Having reservations on both DHCP servers will fit the bill.

    Thanks to all.


  40. Jim Geidl says:


    What you have outlined is excellent as long as there is no requirement for the client machines to have a specific IP.  Your approach could issue different IP’s depending on timing and circumstance.


  41. Alan says:

    I ran across this page searching for how to do this and it was great.  Hundreds of reservations moved in short order.  Thank you.

  42. Pepper says:

    I just used this to bring up a brand new DHCP server on my network. Did the dump command, globally replaced the server name, modified the exclusion ranges and tweaked a couple other things, then saved the file and exec’ed the file.

    Last time I did this I spend about an hour. This time it took maybe five minutes. Thanks!

  43. Pepper says:

    I meant to say, last time I did this without knowing about the netsh method, that’s why it took an hour. Just in case that wasn’t blinkin’ obvious.

  44. Carlo says:

    Used this as basis to rebuild DHCP to extend the subnet mask.  Worked like a dream!  Thanks.

  45. copy reservation scope from one server to another says:

    I'm pretty new to this so I'm a little confuse.  Can you light up a little bit?  What do you mean by:

    This script file (let’s call it reservations.txt) would contain for each reservation an entry like:

    dhcp server scope add   reservedip <MAC ADDRESS>

    Now run this script in the first server by typing:

    How and where did you get it call reservations.txt?  where's the .txt file came from?

  46. Kevinc says:

    Thanks, an old post but still very helpful.

Skip to main content