Quantcast
Channel: martinsblog.dk
Viewing all articles
Browse latest Browse all 320

Microsoft DHCP Server: Export / Import scope WITH leases

$
0
0

When extending a subnet with Microsoft DHCP you cannot change the SUBNET mask on the already running active scope, you need to export, edit, import 🙂

Open Powershell:

Export specified scopes and their leases

Export-DhcpServer -ComputerName “dhcpserver.contoso.com” -File “C:\exportdir\dhcpexport.xml” -ScopeId 192.168.35.0 -Leases

The open the XML file and search for the subnet:

Change the subnet for your requirements, ex. 255.255.0.0

Now go to the DHCP GUI and DELETE the SCOPE you have just exported – yes delete 🙂 (I am sure you have checked you had the right data in the XML first – right?! 🙂 )

Then run this in powershell:

Import configuration and lease data

Import-DhcpServer -ComputerName “dhcpserver.contoso.com” -File “C:\exports\dhcpexport.xml” -BackupPath “C:\dhcpbackup\” -Leases

Refresh the DHCP GUI and you should find that everything is in place, the subnet, though it’s still greyed out, have changed, and the leases already there by the clients are back, so no network issues will occur! 🙂

Source:

Export-DhcpServer (DhcpServer) | Microsoft Docs

Import-DhcpServer (DhcpServer) | Microsoft Docs

 


Viewing all articles
Browse latest Browse all 320

Trending Articles