Export and Import DHCP Scope

I was researching how to change the Subnet Mask of a DHCP scope on a Windows 2008 server. It turns out you can’t change the subnet without deleting the scope and recreating it. If there are a lot of customizations to the scope, though, like reservations and scope options, it’s no easy task to delete and recreate the scope. Luckily I found one page that explains how to export the scope to a text file, make changes, and then reimport it. The whole process takes only a couple of minutes, and you end up with a deleted and rebuilt scope that has all your customizations intact.

WindowsTricks.in explains the commands.

Use the below command to export the scope configuration

Syntax:

C:\>netsh dhcp server \\”Server name” scope “scope subnet” dump>c:\dhcp.txt

Example:

C:\>netsh dhcp server \\Test01 scope 192.168.1.0 dump>c:\dhcp.txt

That creates a text file you can edit to change the Subnet, and whatever else you want changed. Then you have to delete the scope from the DHCP manager, and reimport the text file to create a new scope with the settings you specified.

C:\>netsh exec c:\dhcp.txt

I did it and it was exactly as easy as it sounds. After renewing my lease, the clients had the new DHCP scope. In all, it was a painless operation.


Posted

in

,

by

Tags:

Comments

4 responses to “Export and Import DHCP Scope”

  1. Dale Avatar
    Dale

    This worked great, thank you for the post.

  2. BIlly Avatar
    BIlly

    Everytime I have to do this I can’t remember the commands and have to Google it again. Great time saver though, thanks for keeping the answer available.

  3. sylwok Avatar
    sylwok

    C: \> netsh exec c: \ dhcp.txt (w2012R2)
    That 1h searched in google. Super beer you.

  4. Jeff Brady Avatar
    Jeff Brady

    Holy Crap – spent days trying to figure out how to move 100’s of DHCP ranges from multiple servers to a new server when the server options are different – Powershell failed after hours of trying to edit the XML by hand, NetSH export / import failed as server options are spelled differently.
    use DUMP – search and replace server name and option values, then exec to new server. amazing

    Thank you! 3 years later still EXCELLENT data. Should be on Technet

Leave a Reply

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