Recipe 14.14. Backing Up the DHCP DatabaseProblemYou want to back up the DHCP database. SolutionUsing a graphical user interface
Using a command-line interfaceYou can't initiate a backup from netsh, but you can configure how frequently the automatic backups occur and where backup files are stored. The following command changes the default backup time to 24 hours (1,440 minutes): > netsh dhcp server set databasebackupinterval 1440 The following command changes the backup location to d:\dhcp\backups: > netsh dhcp server set databasebackuppath d:\dhcp\backups You can also dump the DHCP Server configuration to a text file and import it later using netsh. Here is how you export it: > netsh dhcp server dump > dhcpconfig.dmp
Using VBScriptSee the Introduction for more information on how to run the netsh command from within a script. DiscussionThe DHCP Server service automatically performs a backup of the DHCP database and DHCP Server registry configuration key every 60 minutes (and overwrites the previous back up). You can also perform a manual backup as outlined in the GUI solution. Backup files are stored in %SystemRoot%\system32\dhcp\backup by default, but you can change that location as described in the CLI solution. You should change this path to another drive so that a disk failure doesn't impact both the active database and the backup files. The DHCP Server takes care of performing regular database backups, but you'll still need to use a backup tool such as NTBackup to archive those backups on a regular basis. As long as you are backing up the %SystemRoot%\system32\dhcp directory and the system state (which includes the registry), you can restore the database and server configuration on the same server or on another server if necessary. See AlsoRecipe 14.15, Recipe 14.16, MS KB 173396 (How to Restore a Corrupted DHCP Database File), and MS KB 325473 (How to move a DHCP database to a computer that is running Windows Server 2003) |