Книга: Windows Server 2012 R2 Storage, Security, & Networking Pocket Consultant

Saving and restoring the DHCP configuration

Saving and restoring the DHCP configuration

After you configure all the necessary DHCP settings, you might want to save the DHCP configuration so that you can restore it on the DHCP server. To save the configuration, enter the following command at the command prompt:

netsh dump DHCP › dhcpconfig.dmp

In this example, dhcpconfig.dmp is the name of the configuration script you want to create. By default, the script is created in the current working directory. Alternatively, you can specify the full file path in which to save the script. After you create this script, you can restore the configuration by executing the script. If you saved the script in the current working directory, you can enter the following command at the command prompt:

netsh exec dhcpconfig.dmp

If you saved the script in another directory, you can specify the full path to the script, such as:

netsh exec d: dhcpscriptsdhcpconfig.dmp

TIP You can also use this technique to set up another DHCP server with the same configuration. Just copy the configuration script to a folder on the destination computer, and then execute it.

You can save or restore the DHCP configuration by using the DHCP console as well. To save the configuration, press and hold or right-click the DHCP server entry, tap or click Backup, use the dialog box provided to select the folder for the backup, and then tap or click OK. To restore the configuration, press and hold or right-click the DHCP server entry, tap or click Restore, use the dialog box provided to select the backup folder, and then tap or click OK. When prompted to confirm, tap or click Yes.

At an elevated Windows PowerShell prompt, you use Export-DhcpServer to save the configuration settings. The basic syntax is:

Export-DhcpServer -ComputerName ServerID -File SavePath

Here, ServerID is the DNS name or IP address of the DHCP server, and SavePath is the path and name of the file in which you want to store the configuration settings. If you omit the name of the server to work with, the local server is used. If you don’t specify a save path along with the file name, the configuration file is created in the current working directory. In the following example, you store the configuration settings in the d: dhcpscripts directory with the name dhcpconfig.dmp:

Export-DhcpServer-File d: dhcpscriptsdhcpconfig.dmp

You can restore the configuration using Import-DhcpServer. The basic syntax is:

Import-DhcpServer -ComputerName ServerID -BackupPath CurrentConfigSavePath -File SavePath

Here, SavePath is the path and name of the file in which you stored the configuration settings and CurrentConfigSavePath specifies the path where the current configuration should be saved prior to importing and overwriting existing settings. In the following example, you back up the settings to d: dhcpbackuporigconfig. dmp and then apply the saved configuration from d: dhcpscriptsdhcpconfig.dmp:

Import-DhcpServer-BackupPath d: dhcpbackuporigconfig.dmp -File d: dhcpscriptsdhcpconfig.dmp

Оглавление книги


Генерация: 1.035. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз