Powershell DHCP Backup & Restore

DHCP Backup & Restore or Export & Import

Quellsystem:

DHCP exportieren gesamte Konfiguration
Export-DHCPServer –ComputerName DC01.ndsedv.de -File “C:\Temp\DHCP-Config.xml” -Force

Export-DHCPServer –ComputerName DC01.ndsedv.de -Leases -File C:\Temp\DHCPExport.xml -verbose
Backup-DHCPServer -ComputerName “DC01” -Path “C:\Temp\DHCPBackup”

Zielsystem:

Dienst stoppen
Stop-Service -Name DHCPServer

Dienst temporär deaktivieren
Set-Service -Name DHCPServer -StartupType “Disabled”

Dienst prüfen
Get-Service -Name DHCPServer

DHCP importieren aus Backup
Import-DhcpServer -ComputerName DC02 -File “C:\Temp\DHCP-Config.xml -Force

Import-DHCPServer –ComputerName DHCP01.ndsedv.de -Leases –File C:\Temp\DHCPExport.xml -BackupPath C:\Temp\DHCPBackup -Verbose
Restore-DHCPServer -ComputerName “DC01” -Path “C:\Temp\DHCPBackup”

DHCP importieren nur 2 Scopes
Import-DHCPServer –ComputerName DHCP01.ndsedv.de -Leases –File C:\Temp\DHCPExport.xml -BackupPath C:\Temp\DHCPBackup -Verbose –ScopeId 10.100.10.0, 10.100.20.0

Dienst wieder aktivieren
Set-Service -Name DHCPServer -StartupType “Enabled”

Dienst wieder starten
Start-Service -Name DHCPServer