Yea, I like Windows Server 2012, but how do I migrate migrate existing DHCP Server to Windows Server 2012 easily with PowerShell from Windows Server 2008 or 2008R2 and leverage the new DHCP failover feature?
This can be done easily with the new Windows Server 2012 PowerShell cmdlets. Here is how:
Preparation
First, Install Windows Server 2012 as a VM or on physical host as you prefer in your environment. Install DHCP role and authorize the DHCP server.
For example, I have a DHCP server sits on my Primary DC: WS2012VMDC01.sgmic.com. I install another VM as secondary DC:WS2012VMDC02.sgmic.com.
After enable the DHCP server role, go to Windows Server 2012 and create two folders one for export and one for import. In my case, I created folder c:\export and c:\dhcp on the new DHCP server WS2012VMDC02.sgmic.com
Export DHCP server configuration and leases
Windows Server 2012 has new DHCP server PowerShell cmdlets which include export/import based on PowerShell. To export the DHCP server configuration, scopes and leases from a Windows Server 2008 or Windows Server 2008 R2 DHCP server. Below is the command to export DHCP configuration and leases from WS2012VMDC01
Export-DhcpServer –ComputerName MIC-DC01.sgmic.com -Leases -File C:\export\dhcpexp.xml -verbose
If you don’t wish to export lease information, leave out the –Leases switch from the command
Import to the new Windows Server 2012 DHCP Server
Using the DHCP server Windows PowerShell import, the DHCP server configuration can be now be imported on the Windows Server 2012 DHCP server. For my case, i am using the following command:
Import-DhcpServer –ComputerName WS2012VMDC02.sgmic.com -Leases –File C:\export\dhcpexp.xml -BackupPath C:\dhcp\ -Verbose
If you only want to import specific scopes (e.g. 10.1.1.0, 10.1.2.0), you can use the following import command:
Import-DhcpServer –ComputerName WS2012VMDC02.sgmic.com -Leases –File C:\export\dhcpexp.xml -BackupPath C:\dhcp -Verbose –ScopeId 10.1.1.0, 10.1.2.0
DHCP Failover
Windows Server 2012 has a new feature called DHCP failover. You can configure this in two model Load Balance or Hot Standby. Do you need a cluster? No.
You can now take any two DHCP server and failover each other. To configure this, go to DHCP server manager right click and select Configure Failover. Select the failover server and you are all set.
For detailed step-by-step guide for DHCP Failover, refer to TechNet Guide Here
For free Windows Server courses, check out Microsoft Virtual Academy here.
2 Responses to “Migrate Existing DHCP Server to Windows Server 2012 easily with PowerShell”
Jacques MARENGO
Is that method can be used to export non microsoft DHCP configuration especially “leases”?
eric
Hi Jacques. I have imported the 2008R2 DHCP config and scopes to my new 2012r2 DCHP server, which also has all the FSMO roles. Now I have both DHCP server services running. If I stop the 2008r2 services, however, the new server is not responding to requests from clients. Do you know what can be done? Thank you.
Eric