In this tutorial, you will learn how to back up and restore Windows DHCP servers using the DHCP console and PowerShell.
Have you ever experienced a DHCP server crash or failure? Everything will be quiet until the device starts to reboot.
Users will complain that they can’t access E-mail, the Internet stops working and their applications don’t work. This is because the DHCP servers are down and they are not connected to the network.
Starting a new DHCP server is really easy, but do you remember all the scopes you needed to recreate? What about the reserved addresses? Did you memorize all those MAC addresses?
Let’s look at how to back up the DHCP server for quick recovery.
The DHCP database is automatically backed up every 60 minutes
By default, Windows will backup DHCP configuration every 60 minutes at this location % SystemRoot % System32\ dhcp\ backup.
Important: Although Windows automatically backs up the DHCP configuration, if the server crashes and you can’t access the file system, it’s not good for you. You are advised to change the location to network share or use backup software to back up the folder. You can also schedule tasks to copy the backup folder to another location.
Manually perform DHCP backup using the DHCP console
In this example, I configure DHCP on backup server DHCP1. I will restore this backup to server DHCP2 later in the tutorial.
Step 1: Create a backup folder
I have created a folder named DHCPBackup on the server desktop.
Step 2: Open the DHCP management console
Step 3: Right-click the server and select Backup
Select the folder you created in Step 1. In my case, this is the DHCPBackup folder on the desktop. And I’m gonna say OK
Unfortunately, there is no prompt to confirm that the backup is complete.
You can open folders and verify that data has been backed up.
I can see that the files have been written to the folder and it looks like the backup completed successfully.
This is used to manually back up DHCP servers. Now, let’s move on to the restore process.
Restore the DHCP server using the DHCP console
Important: You must copy the backup folder from the above steps to % SystemRoot % System32\DHCP\ backup, or you will receive the following error message indicating that the database was not restored correctly.
Step 1: Log in to the server to which you want to restore the DHCP backup
I log in to the second DHCP server using the host name of DHCP2.
Step 2: Copy the backup to the correct location
Now I 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 choose Restore.
Now select the DHCPBackup folder
You will receive a message stating that the service must be stopped and restarted.
Click yes
Recovery is complete
You can browse the scope to verify that everything is restored correctly.
I have a small lab, but can see that both scopes (leases and reservations) have been restored.
Back up the DHCP server using PowerShell
This example logs in locally to the server.
Back up the DHCP configuration using PowerShell.
Backup-DhcpServer -path c:\DHCPBackup
Copy the code
Use this command to back up the DHCP server from a remote computer
Backup-DhcpServer -ComputerName "dhcp1" -Path "C:\DHCPBackup"
Copy the code
Restore the DHCP server using PowerShell
Step 1: Copy the backup folder to the correct path
Keep in mind that the backup must be copied to C:Window\ sSystem32 \ DHCP \backup or a permission error will occur.
Step 2: Run the following command
PS C:> Restore-DhcpServer -ComputerName "dhcp2" -Path "C:Windows\system32\dhcp\backup"
Copy the code
This allows you to complete the backup and restore process using PowerShell. I hope this article has helped you learn how to back up and restore Windows DHCP servers. Leave a comment or question below and let me know what you think.
This article started at BigYoung