Problem : How to delete all scopes from a DHCP server or synchronize servers in different subnets

Problem : How to delete all scopes from a DHCP server or synchronize servers in different subnets

I am running a network with redundant data centers. I created a scheduled task to export all dhcp scopes from the primary datacenter to the secondary sites using netsh dhcp server commands. This works great for the initial synchronization, but once the other servers have the bulk of the scopes, further imports fail because the scopes already exist. Is there a way to delete all scopes from a dhcp server with a command line so that the import will succeed? Alternatively, is there a way to force the netsh dhcp server \xxxx import to overwrite existing scopes?

As a last option, does anyone have a better suggestion for keeping multiple dhcp servers in multiple sites in sync?


 

Solution: How to delete all scopes from a DHCP server or synchronize servers in different subnets

Ah, I see.

OK – if they need to be identical could we just copy the dhcp server database?

On the primary server do the following:

mkdir C:DHCPBackup
net stop dhcpserver
xcopy /y %windir%system32dhcpdhcp.mdb C:DHCPBack
net start dhcpserver

Share the backup folder, and then schedule that to run everyday at, say, 10pm.

On the backup servers:
net stop dhcpserver
xcopy /y \primaryserverdhcpbackupdhcp.mdb %windir%system32dhcpdhcp.mdb
net start dhcpserver

This copies the DHCP database across from the primary server to the backups – set it to run about 10:05pm