Powershell : export-dhcpserver

Supply , installation and support

Powershell : export-dhcpserver

Export/Import existing scopes

 

Export the DHCP scope ( whilst leaving active on source ) from SERVER using either powershell or netsh

 

Powershell commands:

 

Export-DhcpServer [-File] <String> [-CimSession <CimSession> ] [-ComputerName <String> ] [-Force] [-Leases] [-Prefix <IPAddress[]> ] [-ScopeId <IPAddress[]> ] [ <CommonParameters>]

 

Example: export-dhcpserver -ComputerName SERVER -file “C:PATHNAME.XML”
Pre-Requisites for the PowerShell at that it is run on a windows 2012 server. The PowerShell will export it as an  XML file

 

To import the scope ( note that using the import-dhcpserver it DOES NOT overwrite any existing scopes )

 

Import-DhcpServer -file “C:PATHFILE.XML” -BackupPath “C:PATH”

 

 

NetSh verison :

 

This needs to be run on the server that holds the current DHCP scope that is being exported

 

Netsh export c:tempdhcpdb all

 

I prefer using PowerShell as I have tried and tested it. However it wont work with Windows 2003 servers

 

To import

Copy the .txt file that was created earlier and

 

netsh dhcp server import c:tempdhcp.txt all

 

Again this will NOT overwrite existing scopes. Refresh the window if it doesn’t appear.

Leave a Reply

Your email address will not be published. Required fields are marked *