Migrating a DHCP server doesn’t require manually rebuilding scopes, reservations, or lease data. On Windows Server 2012 and later, the Export-DhcpServer and Import-DhcpServer cmdlets offer a quick and efficient method to transfer the configuration to a new server.
Here are the necessary steps:
- Install the DHCP role on the new DHCP server and skip the service configuration at the end.
- Create a export directory like „C:\export“ on the old server for the exported configuration.
- Run the following PowerShell command to export ALL scopes with leases and reservationa (adjust the computer name!):
Export-DhcpServer –ComputerName ALTER_DHCP_SERVER.domain.tld -Leases -File C:\export\dhcpexp.xml -verboseThe export file is XML-based, allowing scope settings to be reviewed and adjusted before import if needed. This enables the adaptation of ranges or other values during migration, eliminating the need for manual re-entry.
To restore the configuration on the new server, import the file with:
Import-DhcpServer –ComputerName NEUER_DHCP_SERVER.domain.tld -Leases –File C:\export\dhcpexp.xml -BackupPath C:\dhcp\ -VerboseThis approach effectively preserves all scopes, reservations, and leases, ensuring that none of these critical network elements are lost during the process. At the same time, it keeps the migration process clean, organized, and fully repeatable, allowing for consistency across multiple migrations. In environments that contain a large number of reservations, this method is typically much more reliable and efficient compared to manual recreation, which can be prone to errors and omissions.