Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3871
  • Last Modified:

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.
0
rtmcmullen
Asked:
rtmcmullen
  • 2
  • 2
1 Solution
 
Erik BjersPrincipal Systems AdministratorCommented:
0
 
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
0
 
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?
0
 
Michael PfisterCommented:
... 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,
Michael




0
 
rtmcmullenAuthor Commented:
Thanks, that is just what I was looking for.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now