In this tutorial, you will learn how to backup and restore Windows DHCP server using the DHCP console and PowerShell.
Have you ever experienced a DHCP server crash or failure? All is calm until devices start rebooting.
Users will complain that they can’t access email, the internet stops working and their apps no longer work. That’s because the DHCP server is down and they are not getting connected to the network.
It’s really easy to spin up a new DHCP server but do you remember all the scopes you need to re-create? What about those reservations, did you memorize all those MAC addresses?
Let’s check out how to backup your DHCP server for a fast recovery.
DHCP Database Auto Backup Every 60 minutes
By default, Windows will backup the DHCP configuration every 60 minutes at this location %SystemRoot%System32\DHCP\backup.
Important Tip: Although Windows automatically backs up the DHCP configuration it will do you no good if the server crashes and you are unable to access the file system. It is recommended to either change the location to a network share or use backup software to backup the folder. You could also schedule a task to copy the backup folder to another location.
Video Tutorial
If you don’t like video tutorials or want more details, then continue reading the instructions below.
Manual DHCP Backup Using DHCP Console
In this example, I’ll be backing up the DHCP configuration on server DHCP1. Later in this tutorial, I’ll be restoring this backup to server DHCP2.
Step 1: Create a Backup Folder
I’ve created a folder on the server desktop called DHCPBackup
Step 2: Open the DHCP Administration Console
The DHCP console is located in start -> Windows Administrative Tools -> DHCP
Step 3: Right Click the Server and Select Backup
Select the folder that was created in step 1. In my case, this was the DHCPBackup folder on the desktop. Then click OK
Unfortunately, there is no confirmation that the backup was completed.
You can go open the folder and verify data was backed up.
I can see that files were written to the folder, looks like the backup was completed successfully.
That is it for manually backing up the DHCP server. Now, let’s move on to the restore process.
Restore DHCP Server Using DHCP Console
Important Tip: You must copy the backup folder from the steps above to %SystemRoot%System32\DHCP\backup or you will get the following error saying the database was not restored correctly.
Step 1: Log into the server you want to restore the DHCP backup to
I’m logging into my 2nd DHCP server with the hostname of DHCP2.
Step 2: Copy the backup to the correct location
Now I will copy the DHCPBackup folder to %SystemRoot%System32\DHCP\backup
Step 3: Open The DHCP Console and Select Restore
On the DHCP Console, right click the server and select Restore
Now select the DHCPBackup folder
You will get a message that says the service must be stopped and restarted.
Click Yes
Restore complete
You can go browse the scopes to verify everything restored correctly.
I have a small lab but I can see the two scopes, leases, and reservations all restored.
Backup DHCP Server Using PowerShell
In this example, I’ll be logged in locally to the server.
Use the following command to backup the DHCP configuration using PowerShell.
Backup-DhcpServer -path c:\DHCPBackup
If you want to backup the DHCP server from a remote computer use this command
Backup-DhcpServer -ComputerName "dhcp1" -Path "C:\DHCPBackup"
Restore DHCP Server Using PowerShell
Step 1: Copy the backup folder to the correct path
Remember the backup has to be copied to “C:Window\ssystem32\dhcp\backup” or you will get permission errors.
Step 2: Run the following command
PS C:> Restore-DhcpServer -ComputerName "dhcp2" -Path "C:Windows\system32\dhcp\backup"
That completes the backup and restore process using PowerShell. If you need more PowerShell assistance with these commands see the Restore-DhcpServer and Backup-DHCPServer reference guides.
I hoped this article helped you learn how to backup and restore Windows DHCP servers. Let me know what you think by leaving a comment or questions below.
We have setup Microsoft DHCP server in high-availability mode (available since Windows Server 2012 R2). Working fine so far.
What we notice is that the backup we take from each DHCP server node (active and passive server) and that we store in a central repository is showing different size for some servers.
E.g., we have > 200 DHCP server “pairs”; for majority of these DHCP server “pairs” the size of dhcp.mdb is equal for both nodes (active and passive one). For few DHCP server “pairs” the backed up dhcp.mdb is showing different value. Does someone have an explanation for this discrepancy? And maybe a way to fix it?
We just performed this same procedure last week.
Could have used this document to iron out some of the bugs.
In the end it all worked out.
Thank you keeping this as part of procedures document.
Thank you
hi all,
Is it possible to take DHCP configuration using the veeam backup and replication console .?
I don’t think you can backup just the DHCP config with Veeam, but I’m not 100% percent sure about that. You can definitely backup the entire server with Veeam and replicate it.
Thank you!
thank you it was useful for me
Thank you so much , you are a life saver…
You’re welcome, Eric.
Thank you for the Tutorial .
Very useful information to know .