DHCP Scope Export (automated)

Posted on 2007-08-01
Last Modified: 2012-06-21
Trying to come up with a way to export DHCP scopes in an automated fashion.  I tried netsh command: netsh dhcp server export c:\dhcp all - but this did not work.  (2K3 servers - AD).

What I'm trying to accomplish is I have one HA server that acts as a disaster recovery server and am trying to have this server contain all scopes in case of failure.  Another twist is I have 6 DHCP servers for remote sites I'm trying to capture.  I would really like to script and schedule this but am a bit unsure of how to do so.  Would the DHCP server service need to be stopped during export, etc.,??

Any advice would be greatly apprecitated.
Question by:rtmcmullen
    LVL 23

    Expert Comment

    by:Erik Bjers
    LVL 28

    Expert Comment

    I can't see why

    netsh dhcp server export c:\dhcp all

    shouldn't work.
    Maybe its a permssion problem? Are there any errors you're getting?


    Author Comment

    mpfister - actually it worked for me this time.  Question though, is the file exported the configuration file, I noticed it was not viewable?
    LVL 28

    Accepted Solution

    ... I think "export" creates a non-ascii file, but you can successfully import it with "netsh dhcp import..."

    If you want a readable file, you should use "dump"

    netsh dhcp server dump all > dump.txt

    I have no Windows 2003 DHCP available, so I can't check if this command really dumps eveything you'd need.

    Anyway for backup purpose, "export" is the right choice.

    I'd create a short batch script like this:

    netsh dhcp server \\dhcpservername1 export c:\DHCP_Backup_Server1 all
    netsh dhcp server \\dhcpservername2 export c:\DHCP_Backup_Server2 all
    netsh dhcp server \\dhcpservername3 export c:\DHCP_Backup_Server3 all

    and run it on a daily or weekly schedule.

    If you want history:

    netsh dhcp server \\dhcpservername1 export "c:\DHCP_Backup_Server1%DATE%" all
    netsh dhcp server \\dhcpservername2 export "c:\DHCP_Backup_Server2%DATE%" all
    netsh dhcp server \\dhcpservername3 export "c:\DHCP_Backup_Server3%DATE%" all

    Hope it helps,


    Author Comment

    Thanks, that is just what I was looking for.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Enterprise networks where VoIP phones have been deployed frequently use port configurations that allow both a computer and an IP phone to be plugged into the same switch port but use different VLANs. On Cisco equipment I'm referring to the "native V…
    A common practice in small networks is making file sharing easy which works extremely well when intra-network security is not an issue. In essence, everyone, that is "Everyone", is given access to all of the shared files - often the entire C: drive …
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    This video discusses moving either the default database or any database to a new volume.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now