Windows Server – Change a DHCP Scopes Subnet Mask

KB ID 0001177 

Problem

You have probably tried to do this and found he option ‘greyed out’ because in the DHCP management console you can’t change the subnet mask of a scope. 

I needed to change a clients DHCP scope because I was changing their subnet from /24 to /16. I could have simply deleted and recreated the scope, but they has a lot of custom settings for their phone system, and hundreds of reservations (which I know is unusual).

Solution

I wrote an article a long time ago about migrating DHCP scopes, this process uses the same method to take a backup of the scope, then you can edit the subnet mask, and ‘re-import’ the scope again.

First take a backup of the scope, open an administrative command window, and run the following command;

netsh dhcp server \\”Server name” scope “scope subnet” dump>c\:dhcp.txt
i.e.
netsh dhcp server \\Server-DC01 scope 10.0.0.0 dump >c:\temp\dhcp.txt

Server 2012 Export DHCP Scope

 

Then open the C:\dhcp.txt file, and locate the subnet mask;

windows scope change subnet mask

Edit it accordingly, and save the changes.

windows dhcp change mask

 

You can now DELETE the live scope, then reimport the one you just edited with the following command;

netsh exec c:\temp\dhcp.txt 

Server 2012 Import DHCP Scope

Note: As you can see even when is has successfully import dyou will still see a “The following command was not found d error

On older, (pre Windows Server 2012 machines) use the following syntax instead;

netsh dhcp server import c:\temp\dhcp.txt all

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

8 Comments

  1. When I run the import command on 2012R2, I get the request is not supported.

    Post a Reply
  2. I get the same thing as Miles when running the import on 2012 R2 servers. “The request is not supported.” The dump file is from the same sever. Just trying to edit subnet mask.

    Post a Reply
    • There you go, updated for Server 2012 🙂

      Pete

      Post a Reply
  3. My WDS server is on Windows Server 2016 and the second option worked for me
    netsh exec C:\Temp\dhcp.txt

    Post a Reply
  4. This is very helpful for me, Excellent……… 🙂

    Post a Reply
  5. When I run the import command on 2012R2 I get the request The following command was not found: .

    {link}

    Post a Reply
    • Hi Sorry it’s taken me a while to reply, I wanted to run up a 2012 server to make sure the post was still relevant, and the code was correct. The screenshots {above} are new ones I took today, so the procedure still works. Are you running the command window ‘as administrator’? See https://www.petenetlive.com/KB/Article/0000988 is UAC turned off, and can you try putting the export file in a sub folder i.e. so it’s NOT on the root of the C Drive.

      Pete

      Post a Reply

Submit a Comment

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