14.15. Restoring the DHCP Database

Problem

You want to restore the DHCP database.

Solution

Using a graphical user interface

  1. Open the DHCP snap-in on the target DHCP Server.

  2. In the left pane, click the server node.

  3. From the menu, select Action Restore.

  4. Select the folder that contains the backup files (the default location will automatically be opened) and click OK.

  5. If the DHCP Server service is running, you'll be prompted to restart it for the changes to take effect. Click Yes.

Using a command-line interface

You can't initiate a restore from netsh, but if you've exported the DHCP Server configuration with the dump option (see Recipe 14.14), you can import it elsewhere. The following command imports the configuration saved to the file dhcpconfig.dmp:

> netsh exec dhcpconfig.dmp

Discussion

In Recipe 14.14, I outline how the DHCP Server automatically makes a copy of the DHCP database every 60 minutes. The DHCP database contains all the scope information, reservations, leases, and options. The server also backs up a portion of the DHCP Server registry key, which contain settings related to database path and audit logs among other global settings. Most of these registry values can be set with netsh. Run netsh dhcp server set /? to get a list.

If you restore via the DHCP snap-in, both the database and registry key are restored. In order for the change to take effect, you have to restart the DHCP Server if it is already running.

One thing that is not restored, because it is not backed up, is the ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.