Table of Contents
Problem/Question
We attempted to migrate DHCP services from Windows Server 2008 R2 to Windows Server 2019 Standard, however, the process was failed.
I am successfully execute below script on Windows Server 2019 Standard:
Export-Dhcp -ComputerName "server2008r2" -File "C:\dhcp\dhcpexport.xml" -ScopeId 192.168.90.0 -Leases -Verbose
Upon executing the next script, it failed:
Import-DhcpServer -File C:\dhcp\dhcpexport.xml -BackupPath C:\DHCPDB\ -Leases -ScopeOverwrite -Force -ComputerName "server2019" –Verbose
The detail error show as below:
Import-DhcpServer : The functionality is not available on this server version. Version of DHCP server is 6.1.
At line:1 char:1
+ Import-DhcpServer -File "C:\dhcp\dhcpexport.xml" -BackupPath "C:\Wind ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-DhcpServer], Exception
+ FullyQualifiedErrorId : InvalidOperation,Import-DhcpServer
Solution/Answer #1: Transfer DHCP database using Netsh command
Step 1: Log in to the DHCP Server you are about to shut down.
Step 2: Open the command line with administrator privileges.
Step 3: Type the following command to export all the DHCP Server settings:
netsh dhcp server export C:\DHCP-Config.txt all
Note: The .txt file can be named as you want as well as saving it to a folder of your choice. Just make sure to create it before it as netsh does not automatically create it.
Step 4: Connect to the new DHCP Server.
Step 5: Copy the .txt file to the disk.
Step 6: Reopen the command line with administrator privileges.
Step 7: Type the following command to import the settings from the file:
netsh dhcp server import C:\DHCP-Config.txt all
Note: You will need to change the location of the file to suit your case.
Solution/Answer #2: Transfer DHCP database using PowerShell command
Step 1: Log in to the DHCP Server you are about to shut down.
Step 2: Open the PowerShell with administrator privileges.
Step 3: Type the following command to export all the DHCP Server settings:
Export-DhcpServer -ComputerName DC01 -File "C:\DHCP-Config.xml" -Force
Note: The .xml file can be named as you want as well as saving it to a folder of your choice. Just make sure to create it before it as netsh does not automatically create it.
Step 4: Connect to the new DHCP Server.
Step 5: Copy the .xml file to the disk.
Step 6: Reopen the PowerShell with administrator privileges.
Step 7: Type the following command to import the settings from the file:
Import-DhcpServer -ComputerName DC02 -File "C:\DHCP-Config.xml -Force
Note: You will need to change the location of the file to suit your case.