by lunarg on March 27th 2020, at 11:52

On a Windows DHCP Server, if you have a lot of DHCP reservations in a particular scope on a server, and you have the need to migrate them to another scope (on the same or another server), you can do so quickly through netsh (a "legacy" command-line tool to perform network configuration on a Windows system).

Fire up a command prompt (or Powershell). First dump, the current scope configuration to a text file:

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

Note that if you run the command on the server where the originating scope is located, you don't need to specify the IP address/hostname of the server.

Open the text file with your favourite plain text editor (e.g. Notepad). You will see the entire configuration of the scope. If you wish to migrate the entire scope, you only need to replace the hostname of the server with that of the new server, but if only require copying the reservations, you need to look for and copy all of the following commands to a new empty text file. Be sure to only copy lines with explicit IP addresses in there (such as "" in the example below):

Dhcp Server \\ Scope Add reservedip 001122334455 "DHCP" "" "DHCP"
Dhcp Server \\ Scope Set DnsConfig 1 1 1 1

If you wish to migrate the entire scope to another server, do a search and replace to replace the server IP address or hostname, then skip to the last step, and run the text file through netsh to recreate the scope on the new server.

If you only wish to migrate the reservations, copy/paste all the entries like the example above to a new text file, and perform a search and replace on the server name (e.g. and/or the scope (e.g. to the new values for server and scope. Leave the rest as-is.

Don't forget to save the contents to a text file on disk. In our example, we'll name the file reservations.txt.

On the new server (or the same if you're migrating to another scope on the same server), run the contents of the file to create the reservations in the new scope:

netsh exec reservations.txt

This will run the file through netsh like a batch file, and create the reservations.

« May 2024»
« You only find out who is swimming naked when the tide goes out. »
Warren Buffett