Export and Import DHCP Scopes with netsh and Export-DhcpServer / Import-DhcpServer

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

Quick answer

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.

netsh or PowerShell?

Tasknetsh dhcp serverExport-DhcpServer / Import-DhcpServer
Export the whole DHCP configurationexport c:\temp\dhcpdb allExport-DhcpServer -File <file> (all DHCPv4 and DHCPv6 scopes and server settings)
Export only some scopesexport 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 leasesNot covered in Microsoft's netsh article-Leases on export and on import
Import everything or only some scopesimport c:\temp\dhcpdb all, or list the scopesImport-DhcpServer -File <file> -BackupPath <folder>, optionally -ScopeId or -Prefix (other scopes in the file are ignored)
A scope already exists on the targetNot covered in Microsoft's netsh articleWithout -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 settingsNot covered in Microsoft's netsh article-ServerConfigOnly
PermissionsMember 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

Export and import DHCP scopes with netsh

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

Export-DhcpServer exports the DHCP server service configuration, and optionally the lease data, to an XML file.

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

Import-DhcpServer imports the configuration, and optionally the lease data, from an export file onto the target DHCP server.

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

Migrating to a new DHCP server

  1. On the source server, export the configuration and leases: Export-DhcpServer -File C:\exportdir\dhcpexport.xml -Leases (or netsh export ... all).
  2. Copy the file to the target server.
  3. On the target, import with a backup path: Import-DhcpServer -File C:\exportdir\dhcpexport.xml -BackupPath C:\dhcpbackup\ -Leases. Use -ScopeOverwrite only if you mean to replace scopes that already exist there.
  4. Check the result with 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.

netsh migration and DHCP failover on Windows Server 2012

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.

Related tools and guides

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.

FAQ

How do I export DHCP scopes with netsh?

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.

Why does netsh dhcp export give Access Denied?

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.

How do I include leases when I move DHCP scopes?

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.

What happens if the scope already exists on the target server?

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.

Can I import only the DHCP server options and classes?

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.

Want the full kit?

Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.