Windows Server

How to backup and restore a Windows DHCP Server via the DHCP Manager and PowerShell

Dynamic Host Configuration Protocol (DHCP) is a standard protocol defined by RFC 1541 (which is superseded by RFC 2131) that allows a server to dynamically distribute IP addressing and configuration information to clients. See this guide for more information on how DHCP works. In order to avoid downtime, it is recommended to have multiple DHCP servers running. In case of a DHCP crash, you do not want to be found wanting, because of this, it is recommended to backup your DHCP servers. With this, you will be able to restore your DHCP configuration such as DHCP Scopes, DHCP reservations, DHCP options, etc. quickly.

The system administrator set-up a DHCP Server and configure the DHCP Server and create DHCP scopes with the options that are parsed out to the client. The DHCP server provides the client with at least this basic information:
– IP Address
– Subnet Mask
– Default Gateway and other parameters such as Domain Name Service (DNS) server addresses.

Step A: For the steps below to backup a DHCP server: I do not have an external location but will simulate this by creating a folder on the DHCP server and use Robocopy to move the files to an external location.
– Launch the DHCP Manager as shown below

This will open the DHCP Console as shown below

Here right-click the DHCP Server and
– Click on Backup as shown below.

Note: By default, Windows will backup the DHCP configuration every 60 minutes at this location %SystemRoot%System32\DHCP\backup.But this will it will do you no good if the server crashes because you will not be able to access the file system on the server.
- Therefore, it is recommended to either change the location to a network share or on dedicated storage.
- Also, ensure to schedule a task to copy the backup folder to another location.

Next, this will open the “Browse For Folders” window as shown below.
– But I will select the folder I created (You can select a network path here as well).

Note: There is no confirmation that the backup completed. Navigate to the folder and verify data was backed up.

For some other articles I created on DHCP, see the following links
– For DHCP specific reference console icons
– Information on BOOTP Vendor Extensions and DHCP Options
– For your domain isn’t available – Why Can’t I Connect with a 169.254 IP Address?

Step B: To restore the DHCP Server. Let us assume there was a crash. Below are the steps to perform this.
– Open The DHCP Console and
– Click on Restore

Next, this will open the “Browse For Folders” window as shown below.
– Select the folder where the backup file is stored as shown below

Next you will get a prompt stating in order for changes to take effect, services must be stopped and restarted.
– Click on Yes

The image below shows the services being stopped and started.

When the above steps completes successfully, the following DHCP message will be dispalyed.

As you can see, my reservations, scopes etc are still intact because they were successfully restored.

PowerShell – DHCP Backup
– Use the following command to backup the DHCP configuration using PowerShell.

Backup-DhcpServer -path C:\Users\Administrator\Desktop\DHCP backup

If you want to backup the DHCP server from a remote computer use this command

Backup-DhcpServer -ComputerName "techdirectarchiveMain" -Path "Backup-DhcpServer -path C:\Users\Administrator\Desktop\DHCP backup"

PowerShell – DHCP Restore
– Run the below command below with the server name you wish to restore the backup to. Also, enter the path where the backup will be pulled from.

PS C:> Restore-DhcpServer -ComputerName "techdirectarchiveStandly" -Path "C:\Users\Administrator\Desktop\DHCP backup"

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x