Migrating DHCP roles between Windows servers can be painful. I wanted to share my favorite method for doing this. I think it is the least difficult and the most effective way of getting your DHCP services moved to a newer Windows server with ZERO downtime. It isn’t perfect and it can fail. However, it works most of the time and when it does, you will feel like it was too easy!
In this post we will be moving DHCP from a 2008 server to a 2012r2 server. The process is the same with 2003/2008/2008r2 to 2012/2012r2. So this should be very flexible for referencing on all Windows servers in production with DHCP roles.
-Both servers must be members of the same domain
-This is a method for migrating the exact same scope so they must be on the same subnet as the scope we are migrating
-You must have local admin rights to the servers and have domain DHCP Admin rights
-The source database must be healthy and reconciled
-The source scope leases must not be full
-The source scope must not be a part of a super-scope. This is for standalone DHCP server scopes only. If you want to create 2012/2012r2 load balancing or fail-over scopes after the migration it should be no problem.
First, let’s get the DHCP role installed on the destination server. Authorize it with some DHCP Admin credentials and leave it as is for now with no scope.
Second, let’s go to the source DHCP server. Open a command prompt as an Administrator and enter the following command:
netsh dhcp server export C:\dhcp.txt all
Next, we will copy the file we just exported (dhcp.txt) to the root of the destination server C drive.
Then we will need to open a command prompt on the new DHCP server as Administrator and type this command:
netsh dhcp server import Cdhcp.txt all
Open the DHCP console on the destination server and verify that the database has moved over with leases and reservations intact. If so, stop and disable the DHCP service on the source DHCP server and you are ready to service new DHCP leases!
If you have trouble with the leases no showing up or with the reservations not giving out the proper IP address or any other some funky issues, then do the following on the new DHCP server:
-Export all content using this command (As Admin): netsh dhcp server export ALL
-Stop the DHCP service
-Delete the database at: c:\windows\system32\dhcp\dhcp.mdb
-Start the DHCP service
-Import the database with this command (As Admin): netsh dhcp server import ALL
-Reopen the DHCP console and confirm the leases show up and the reservations are correct
That is it. I hope this covered the process for you. If you have something to add please comment or email. I would love to hear from you on this.