DHCP Scope Export (automated)

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.
Who is Participating?
Michael PfisterConnect With a Mentor Commented:
... 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,

Erik BjersPrincipal Systems AdministratorCommented:
Michael PfisterCommented:
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?

See http://support.microsoft.com/kb/325473/en-us
rtmcmullenAuthor Commented:
mpfister - actually it worked for me this time.  Question though, is the file exported the configuration file, I noticed it was not viewable?
rtmcmullenAuthor Commented:
Thanks, that is just what I was looking for.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.