Migrate DHCP Scope(s) to Windows Server 2022

Migrate DHCP KB ID 0001792

Problem

If you have a lot of DHCP scopes, options, or reservations, then manually creating them on your new DHCP servers can be a both a time consuming and tedious process. If only there was an easier way?

Migrate DHCP with Netsh

Below you can see an example, where  I have many scopes and lot’s of settings that would be painful to have to recreate from scratch. This example is on Server 2008 R2,but your source server could be server 2000, (or newer) the export procedure is the same.

Open an administrative command window, and issue the following  command.

netsh dhcp server export C:\dhcp-export.txt all

Now on the source DHCP server I’m stopping and disabling the DHCP SERVER service, you might want to wait until, you are about to authorise the new 2022 DHCP server to minimise downtime, before doing this in production.

Copy the exported text file from the old DHCP server, to the new server.

Migrate DHCP 2022

Migrate DHCP: Install DHCP on Server 2022 (via PowerShell)

Open an administrative PoweShell window, and issue the following  command.

Install-WindowsFeature DHCP -IncludeManagementTools

Install DHCP on Server 2022

Then import the settings with the following command.

netsh dhcp server import C:\dhcp-export.txt all

Migrate DHCP 2022

Go to Administrative Tools > DHCP > You should see your migrated information in here, the DHCP scopes will be down (because the server has not yet been authorised in AD). Right click the server name, and select Authorise.

Authorize DHCP Server on Server 2022

Note: At this point ENSURE the old DHCP server has had its DHCP server service stopped and disabled.

Wait a few seconds and then restart the DHCP Server service, (this can be done as shown below).

Restart DHCP Server on Server 2022

After a few seconds, the new scopes should be up and getting served.

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

4 Comments

  1. Thank you for all your tutorials!

    Post a Reply
  2. Thank you very much for all your guides! I recently did a 2012R2 DHCP migration to 2022. The import/export process went well except for one thing I just noticed. We run some software that relies on a few policies to be set on the scope it’s being run in. For some reason, the netsh export/import did not migrate the custom policies I had in a scope on the 2012R2 server. It wasn’t all that bad. I ended up manually typing them into the new DHCP server. I’m just wondering why they may not have migrated over. I ran the netsh command ending with the “all” parameter too. Are policies just excluded? Or is there too much of a difference between 2012R2 and 2022 that it could not be imported? Thanks in advance!

    Post a Reply
    • Honest answer “I dont know”, but I’ll throw it open….

      Post a Reply
  3. Hey Pete, we used NETSH for DHCP migrations until we realized it doesn’t migrate all of the “Scope Options” as this person mentioned. We found a better way that includes all of the scope options that seems to supersede the NETSH command:

    On the source DHCP server, in an elevated PowerShell, run the following command. You can specify individual scopes using the -ScopeId option, otherwise all scopes will be exported: 

    Export-DhcpServer -ComputerName -File C:\temp\server.xml [-ScopeId x.x.x.x,x.x.x.x,..] 

    On the destination DHCP server, in an elevated PowerShell, run the following command. You can specify individual scopes using the -ScopeId option, otherwise all scopes will be imported: 

    Import-DhcpServer -BackupPath C:\temp\dhcp-backup -File C:\temp\server.xml  [-ScopeId x.x.x.x,x.x.x.x,..] 

    Post a Reply

Submit a Comment

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