windows server - how to change a subnet mask of a dhcp scope

for example change subnet mask from a scope to

1) export to xml file using powershell
Export-DhcpServer -Computername <name of computer> -Leases -File C:\export_dhcpserver.xml -verbose

<name of computer could be or localhost if do export the configuration directly from the server>

2) make a copy of the exported file, name it: import_dhcpserver.xml

3) edit the import_dhcpserver.xml file and replace the dhcp scope section,
and all lease entries that reference to the section name:

3.1) dhcp scope section, change the ScopeId + the subnet mask
<SubnetMask></SubnetMask> #change subnet mask here

3.2) dhcp lease entrie, make sure to change the ScopeId to the new scope id
<ScopeId></ScopeId> #change the scope ip here

4) delete the scope id(s) from the dhcp server, using the dhcp admin tool

5) now import the new file:
Import-DhcpServer -Computername <name of computer> -Leases -File C:\import_dhcpserver.xml -BackupPath C:\dhcpbackup\ -Verbose

6) Restart both DHCP client and Server services

7) check the dhcp tool if everything looks fine

computer2know :: thank you for your visit :: have a nice day :: © 2024