Move DHCP scopes to another server: netsh dhcp server export/import (local Administrators, Domain Admins can get Access Denied) or Export-DhcpServer and Import-DhcpServer with -Leases, -ScopeOverwrite and -ServerConfigOnly.
Home › Guides › Export and import DHCP scopes
Last updated 23 November 2026
To copy DHCP scopes from one Windows DHCP server to another, export them on the source and import them on the target. With netsh (KB 281626): open netsh, enter dhcp server \\servername, then export c:\temp\dhcpdb all (or list scopes, such as export c:\temp\dhcpdb 10.0.0.0 20.0.0.0) and on the target import c:\temp\dhcpdb all. Run it as a member of the local Administrators group: Microsoft says an account that's only in Domain Admins may get Access Denied. With PowerShell: Export-DhcpServer -File C:\exportdir\dhcpexport.xml -Leases on the source, then Import-DhcpServer -File C:\exportdir\dhcpexport.xml -BackupPath C:\dhcpbackup\ -Leases on the target. The cmdlets can also pick scopes (-ScopeId, -Prefix for DHCPv6), overwrite existing scopes (-ScopeOverwrite) or import only the server-level settings (-ServerConfigOnly). On Windows Server 2012 DHCP failover, scopes migrated with netsh export/import can leave partners out of sync; the PowerShell cmdlets avoid that.
| Task | netsh dhcp server | Export-DhcpServer / Import-DhcpServer |
|---|---|---|
| Export the whole DHCP configuration | export c:\temp\dhcpdb all | Export-DhcpServer -File <file> (all DHCPv4 and DHCPv6 scopes and server settings) |
| Export only some scopes | export c:\temp\dhcpdb 10.0.0.0 20.0.0.0 | -ScopeId 10.10.10.0,10.20.20.0 or -Prefix for DHCPv6 (server-level settings are exported too) |
| Include leases | Not covered in Microsoft's netsh article | -Leases on export and on import |
| Import everything or only some scopes | import c:\temp\dhcpdb all, or list the scopes | Import-DhcpServer -File <file> -BackupPath <folder>, optionally -ScopeId or -Prefix (other scopes in the file are ignored) |
| A scope already exists on the target | Not covered in Microsoft's netsh article | Without -ScopeOverwrite: a warning, and the import moves on to the next scope; with it: the scope is deleted and re-created from the file |
| Only server-level settings | Not covered in Microsoft's netsh article | -ServerConfigOnly |
| Permissions | Member of the local Administrators group (Domain Admins only: may get Access Denied) | Not stated in the cmdlet reference; run on the DHCP server or remotely with -ComputerName or -CimSession |
Microsoft's article How to use the Netsh utility to export and import DHCP scopes (KB 281626, all Windows Server versions) covers the two DHCP commands in Netsh.exe: export and import. You can use them to selectively export and import scopes.
Permissions first. You can use Netsh.exe to import and export DHCP scopes only if the active account is a member of the local Administrators group. If the account belongs to the Domain Admins group, you may receive an "Access Denied" error message, even though Domain Admins is a member of the built-in Administrators group. If you get Access Denied, run the commands with an account that is directly in the local Administrators group on the server.
From a Netsh command prompt, go to the DHCP commands for the server you administer (servername is the DHCP server):
netsh dhcp server \\servername
Then, at the NETSH DHCP SERVER prompt, export:
export c:\temp\dhcpdb all export c:\temp\dhcpdb 10.0.0.0 20.0.0.0
The first line exports the full service configuration to c:\Temp\Dhcpdb; the second exports only the configuration of scopes 10.0.0.0 and 20.0.0.0. On the target server, import the same way:
import c:\temp\dhcpdb all import c:\temp\dhcpdb 10.0.0.0 20.0.0.0
The first imports the full configuration from the file, the second only the configuration of the two listed scopes. Copy the file to the same path on the target first if you export and import on different servers.
Export-DhcpServer exports the DHCP server service configuration, and optionally the lease data, to an XML file.
-ScopeId or -Prefix it exports the whole configuration, including all DHCPv4 and DHCPv6 scopes. With -ScopeId (IPv4 scope IDs) or -Prefix (IPv6 subnet prefixes) it exports only those scopes plus all server-level settings.-Leases adds the IP address leases.-File is required. A relative path is created in the current working directory. If a file with that name already exists, the cmdlet returns an error unless you add -Force, which overwrites it.-ComputerName (DNS name or IP address of the DHCP server) or -CimSession runs it against a remote server; -WhatIf shows what would happen without running.Microsoft's examples:
Export-DhcpServer -ComputerName "dhcpserver.contoso.com" -File "C:\exportdir\dhcpexport.xml" Export-DhcpServer -ComputerName "dhcpserver.contoso.com" -File "C:\exportdir\dhcpexport.xml" -ScopeId 10.10.10.0,10.20.20.0 -Leases Import-Csv -Path "ScopeList.txt" | Export-DhcpServer -ComputerName "dhcpserver.contoso.com" -File "C:\exportdir\dhcpexport.xml" -Leases
For the last one, ScopeList.txt has a ScopeId header line followed by one scope ID per line (for example 10.10.10.0, 20.20.20.0, 30.30.30.0).
Import-DhcpServer imports the configuration, and optionally the lease data, from an export file onto the target DHCP server.
-BackupPath is required: the DHCP server database is backed up to that path before the import makes any configuration changes.-ScopeId or -Prefix, everything in the file is imported; with them, only those scopes (other scopes in the file are ignored, server-level settings in the file are still imported).-Leases imports the lease data too.-ScopeOverwrite to delete and re-create it from the file.-ServerConfigOnly imports only server-level settings (class definitions, option definitions, option values, server-level policies and MAC address filters for DHCPv4, and other server properties such as ConflictDetectionAttempts and the DHCPv6 stateless store) and skips every scope in the file.-Force runs without asking for confirmation.Microsoft's examples:
Import-DhcpServer -ComputerName "dhcpserver.contoso.com" -File "C:\exports\dhcpexport.xml" -BackupPath "C:\dhcpbackup\" -Leases Import-DhcpServer -ComputerName "dhcpserver.contoso.com" -File "C:\exports\dhcpexport.xml" -BackupPath "C:\dhcpbackup\" -ScopeId 10.10.10.0,10.20.20.0 -Leases -ScopeOverwrite Import-DhcpServer -ComputerName "dhcpserver.contoso.com" -File "C:\exports\dhcpexport.xml" -BackupPath "C:\dhcpbackup\" -ServerConfigOnly
Export-DhcpServer -File C:\exportdir\dhcpexport.xml -Leases (or netsh export ... all).Import-DhcpServer -File C:\exportdir\dhcpexport.xml -BackupPath C:\dhcpbackup\ -Leases. Use -ScopeOverwrite only if you mean to replace scopes that already exist there.Get-DhcpServerv4Scope and the lease view in the DHCP console.Microsoft's DHCP failover article uses the same pair, with $env:SystemRoot\System32\Dhcp\Temp.txt as the file and Restart-Service DHCPServer after the import. If the new server doesn't hand out addresses because it isn't authorized in Active Directory (event 1046), see DHCP server authorization failures.
On Windows Server 2012, Microsoft documents a known issue: when scopes were migrated with netsh dhcp server export and netsh dhcp server import (or the server was upgraded) while a scope had inactive reservations, failover partners can report different failover states and some leases don't replicate. The fix is cumulative update KB 2756872 and re-creating the failover relationship; migrating with Export-DhcpServer and Import-DhcpServer avoids the issue. Details are in DHCP failover events 20291 and 20292.
Look up DHCP Server events such as 1046 and 20291 in the Windows Event ID Lookup, copy the Export-DhcpServer and Import-DhcpServer lines from the PowerShell Cheat Sheet, pull scope IDs out of netsh or export output with the Regex Tester, check scope subnets before you import with the IPv4 Subnet Calculator or IPv6 Subnet Calculator, and identify the vendor of leased clients with the MAC Vendor Lookup. Related guides: DHCP failover events 20291 and 20292, DHCP server authorization failures, DHCP scope out of addresses and common Windows DNS Server and DHCP Server errors.
Need a full copy of the DHCP database instead? See back up and restore a Windows DHCP server.
One failover partner down while you move scopes? See DHCP failover COMMUNICATION INTERRUPTED and PARTNER DOWN.
Every Windows DNS Server and DHCP Server event and symptom in one place: common Windows DNS Server and DHCP Server errors.
Open netsh, enter dhcp server \\servername, then export c:\temp\dhcpdb all for everything or export c:\temp\dhcpdb 10.0.0.0 20.0.0.0 for listed scopes. Import with import c:\temp\dhcpdb all on the target.
Microsoft says Netsh.exe can export and import DHCP scopes only if the account is a member of the local Administrators group; an account that belongs to Domain Admins may get Access Denied.
Use the PowerShell cmdlets with -Leases on both sides: Export-DhcpServer -File dhcpexport.xml -Leases on the source and Import-DhcpServer -File dhcpexport.xml -BackupPath C:\dhcpbackup\ -Leases on the target.
Import-DhcpServer shows a warning and moves on to the next scope. With -ScopeOverwrite it deletes the existing scope and re-creates it from the export file.
Yes. Import-DhcpServer -ServerConfigOnly imports only server-level settings such as class definitions, option definitions and values, server policies and MAC address filters, and skips every scope in the file.
Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.