by lunarg on September 15th 2017, at 10:06

Sometimes it may become necessary to make changes to a DHCP scope on your Windows DHCP Server. Unfortunately, for existing scopes, not all scope options are editable, and it can become quite a hassle to recreate the scope, especially when there are a lot of reservations. Luckily, there's a workaround which allows you to edit the scope options, which is by using netsh.

It is not possible for netsh to directly edit scope options, but you can create a dump of the complete scope configuration (including all reservations), edit the resulting file, and import it back into the DHCP server. For this to work, you'll need admin (elevated) privileges on the DHCP server.

The procedure described below will clear the DHCP leases database as it cannot be exported using netsh. If the leases database is important, do not use this procedure!

First, determine which scope you want to make changes to. You'll need the scope subnet (something like "" if your network is

Next, start an elevated command prompt. As some temporary files will be created, you may want to "cd" to a temporary folder (e.g. C:\temp.

Dump the configuration of the scope using netsh:

netsh dhcp server scope dump > scope.txt

This will dump the complete scope configuration to a file. As the output is plain text (it is in fact a netsh-script), you can make changes to that file, and thus, change anything in the scope using a text editor (e.g. Notepad).

Suppose you want to extend your subnet from to, edit the file and make the following changes:

  • Do a search and replace for scope and change all occurences to scope This is necessary as extending your subnet from /24 to /23, means the first address is, resulting in the scope subnet to become
    A good tool to determine this is IPCalc.
  • Change the subnet mask from to This can be done by editing the line:
    Dhcp Server \dhcp-server.mydomain add scope "My DHCP Scope" ""
    Change it to:
    Dhcp Server \dhcp-server.mydomain add scope "My DHCP Scope" ""

Before closing your editor, be sure to remove the first line of text (saying Changed the current scope context to x.x.x.x scope.), which is not part of the script. There's no way to filter this out during the dump, so it needs to be done manually. If not removed, the import will fail.

Once your file is ready, first remove the scope in the DHCP server (necessary as we will re-import the changed scope). Before doing so, if you're using DHCP failover, you should remove the failover partnership before removing the scope.

With the scope removed, you can now use netsh to re-import the file and recreate the scope, with the changed scope options, but with everything else intact (including a possibly long list of reservations):

netsh exec scope.txt

The scope will now be recreated, with the changes you made and with every other aspect of the scope (including reservations) intact. If you were using failover, recreate the failover partnership to your backup DHCP server.

« December 2023»
« I needed a password with eight characters so I picked Snow White and the Seven Dwarves. »