FeaturedMicrosoft

Migrating DHCP from Windows Server 2012 R2 to Server 2019

I’m needing to migrate from Windows Server 2012 R2 to 2019. This is fairly straight forward with PowerShell. This guide assumes you have an existing 2012R2 server with DHCP role and a clean 2019 server fully patched.

Before you begin document your current system such as current hostname / and IP Address. I’m going to be reusing the same hostname and IP.

  1. Lower DHCP lease times to ~30mins at least 24hrs before swapping servers. This would ultimately depend on what your current lease times are. Ours are 24hrs so I’m going to change them to 30mins. Once we authorize the new server, I’ll reset them to 24hrs.
  2. On the the 2012R2 server open a PowerShell instance (run as admin)
  3. Run the following command:
Export-DhcpServer -File C:\DHCPdata.xml -Leases -Force -ComputerName OLDSERVERNAME â€“Verbose

Don’t forget to change the -ComputerName matching your server 2012R2 hostname.

Verbose of exporting DHCP

4) Save the file created in the root of C:\ to your new Server 2019 Server.

5) Install the DHCP Server Role via server manager.

Installing DHCP Role
Install Complete, as you can see the server isn’t authorized yet.

6) Let’s import our previous config. Open Powershell (run as admin) and put in:



Import-DhcpServer -File C:\DHCPdata.xml -BackupPath C:\DHCP\ -Leases -ScopeOverwrite -Force -ComputerName NEWSERVERNAME â€“Verbose
Scopes are now created on the new server.

7) If everything looks good, lets authorize the new server! Right click your DHCP server and select Authorize.

You should have some green checkmarks if its activated!

8) Deauthorize your old server following the same steps in the last step but on the server to decommission. Instead of authorize, it will say deauthorize.

9) It can take a few mins for the status to update.

If it’s not updating here are some commands to use. Run these on your DHCP servers.

Show active DHCP servers

netsh dhcp show server

Remove a currently registered DHCP server (replace hostname and IP with your old server)

netsh dhcp delete server dhcp01.contoso.com 10.0.1.2

Authorize a DHCP server

netsh dhcp add server dhcp02.contoso.com 10.254.1.2

10) Verify you only have 1 authorized DHCP server

New hostname is matching the IP

11) Increase the lease times from 30mins back to your original times per scope.

12) Done!

Show More

Cory Fiala

Technology and outdoor enthusiast. Anything from desktops to servers with a side of mountain biking and skiing. Life is good!

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button