Windows Server DHCP import/export scopes using netsh.exe

dhcp-serverwindows-server-2012-r2

We have Windows Server 2008R2 as domain controller with DHCP Server functionality. Task was to make reserve server on remote site in case of failure of main one. The reserve one will be running Windows Server 2012R2. The question was how to keep remote server DHCP records up-to-date. Since there is no DHCP replication possible between 2008R2 and 2012R2, and DHCP cluster is not an option, I've tried using netsh dhcp import/export approach to run every hour on schedule.

Export BAT-file on local site:

@echo off
c:
cd c:\DHCP-Export
echo DHCP Server configuration export started at %date% %time%
netsh dhcp server export \\192.168.2.10\DHCP-Import\dhcpcfg.exp all
echo DHCP Server configuration export finished at %date% %time%
@echo on

Import BAT-file on remote site:

echo DHCP Server configuration import started at %date% %time%
netsh dhcp server import c:\DHCP-Import\dhcpcfg.exp all
echo DHCP Server configuration import finished at %date% %time%

This tasks were put on schedule with administrative account. First import was made from auxiliary DC to remote server and was OK, remote server got scopes from file. But then, when I've made export from primary DC (with different scopes) and imported it into remote I was still seeing old scopes in DHCP console of remote server and no new ones, while I was expecting to see scopes from primary server.

What am I doing wrong? Should I drop remote's DHCP configuration somehow before import?

Best Answer

I'm kinda solved it. I should delete previous scopes.

netsh dhcp server delete scope 192.168.1.0 DHCPFULLFORCE