Migrate Existing DHCP Server to Windows Server 2012 easily with PowerShell

Migrate Existing DHCP Server to Windows Server 2012 easily with PowerShell

Yea, I like Windows Server 2012, but how do I migrate my Windows Server 2008 or 2008R2 DHCP to new Windows Server 2012 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

This entry was posted in Computers and Internet, Techie Hobbies and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s