Question : 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.

Answer : DHCP Scope Export (automated)

... 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




Random Solutions  
 
programming4us programming4us