PowerShell: Move DHCP Server to a new server
This weekend I had a quick maintenance item to complete with a client who wanted to move his DHCP server functions from a physical server to a new VMware vSphere Virtual Machine. Highly available and protected from hardware failure, this process was super easy.
There are a few ways to import/export your DHCP configurations but we used Powershell for this.
On the Source Server, run the following PowerShell command:
This creates an easily readable XML file that includes all of your scopes and options. You can easily verify that you have what you need by viewing the XML file in a viewer. If you need the active leases, just append -Leases at the end of the command.
Once you have the file, you can deactivate the current DHCP and move the functions to the new server. On the new VM, we ran the following PowerShell command:
The BackupPath will just dump the existing configuration before overwriting it with the imported information. If you have lease data from the first step, just append -Leases to the end of the command like before.
Once the configuration is imported, you can authorize the new DHCP server and activate the scope. Test and enjoy the rest of your day.
Happy DHCP Leasing!
– Carlo