A time may come when you need to migrate your existing DHCP services to new servers/hardware. Windows Server 2012 ships with powershell cmdlets to make this a simple transition.
You can read about the process here: http://blogs.technet.com/b/teamdhcp/archive/2012/09/11/migrating-existing-dhcp-server-deployment-to-windows-server-2012-dhcp-failover.aspx
I have two DHCP servers (Windows Server 2012) in a failover configuration, leveraging the new capabilities in failover DHCP for Server 2012, which you can read about here: http://technet.microsoft.com/en-us/library/jj200226.aspx. I will be migrating these to Windows Server 2012 R2 DHCP servers.
I start by installing the DHCP server role on my new 2012 R2 DHCP servers. Then, a quick configure using the Post install wizard from server manager to authorize the DHCP servers in AD.
Next up – I need to export the DHCP server configuration in powershell, from the old server. In this case, I will be migrating from two DCHP servers (DC1,DC2) and migrating them to the new ones (DC01,DC02).
Create a folder on the new DHCP primary server (DC01) for C:\export. Open an administrator powershell session. Run the following command to export remotely from the old DCHP primary server:
Export-DhcpServer –ComputerName DC1.opsmgr.net -Leases -File C:\export\dhcpexp.xml –verbose
Next up, we need to create a backup path for the DHCP server database on the new DHCP server, DC01. Create a folder C:\dhcp\backup. Then, we can import the old DHCP server configuration using the following command:
Import-DhcpServer –ComputerName DC01.opsmgr.net -Leases –File C:\export\dhcpexp.xml -BackupPath C:\dhcp\backup\ -Verbose
The last import we need to run, is to import the server configuration ONLY to the secondary, or failover DHCP server. First, on DC02 (the new failover DHCP server) create a backup folder at C:\dhcp\backup. Then, go back to DC01 where you have the local export files, and run the following command to import server config to DC02:
Import-DhcpServer –ComputerName DC02.opsmgr.net –File C:\export\dhcpexp.xml –ServerConfigOnly –verbose –BackupPath C:\dhcp\backup\
At this point, we have imported the server configuration to BOTH new DHCP servers, and we have imported all the lease and scope to the new primary DCHP server. What we need to do in order to complete the configuration, is to set up the failover configuration on the new pair. This is covered here: http://technet.microsoft.com/en-us/library/hh831385.aspx#failover_1
On DC01, open the DHCP control applet, and right click IPv4 (all scopes) or specific scopes, and click “Configure Failover”
Step through the wizard, and choose “Load balance" mode.
Provide a shared secret for the DCHP servers to authenticate with each other for replication.
You will now see the failover configuration data for each scope:
Open the DHCP applet on the secondary failover DHCP server, and you should see the replicated scope and lease information:
You can de-activate the scopes on the old DHCP server. After testing and functional approval, you can remove DHCP services from the legacy DHCP server computers.