Change DHCP Scope subnet mask and others settings using netsh

  • Backup your current DHCP scope configuration by running the following command in a Command Prompt:
netsh dhcp server \\”Server name” scope “scope subnet” dump > c:\dhcp.txt
  • Modify the .txt file to reflect your changes using Notepad++. Why? Because the file encoding would be incorrect and can return errors when running the “netsh exec” command in a later step.

IE: if you want to change your subnet mask from /24 to /25, change:

Dhcp Server \\servername add scope 192.168.0.0 255.255.0.0 "xxx" "xxx"
to
Dhcp Server \\servername add scope 192.168.0.0 255.255.128.0 "xxx" "xxx"

Before saving your file, in Notepad++, set the encoding to ANSI.

  • Stop “DHCP Server” service.
  • Navigate to
C:\Windows\System32\DHCP

and rename both the “dhcp.pat” and “dhcp.mbd” files to .old

  • Start “DHCP Server” service.
  • In a Command Prompt, run the following command to apply your new settings:
netsh exec c:\dhcp.txt

New settings should now have been applied. Sometimes, it is not reflected immediately to the DHCP console, just wait a few minutes.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s