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 "10.20.30.101" in the example below):
Dhcp Server \\DHCP01.domain.com Scope 10.20.30.0 Add reservedip 10.20.30.101 001122334455 "DHCP Client.domain.com" "" "DHCP" Dhcp Server \\DHCP01.domain.com Scope 10.20.30.0 Set DnsConfig 10.20.30.101 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. DHCP01.domain.com) and/or the scope (e.g. 10.20.30.0) 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.
« ‹ | November 2024 | › » | ||||
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |