Auto Restore DHCP Backup on Microsoft DHCP Server When Restart (Windows Server 2019)

I have a Windows Server 2019 with DHCP Server installed and a scope configured. To protect the scope from accidental misconfigurations or disasters, I'd like to set a protection method so when I restarted the DHCP Server, It will restore the previous DHCP Backup automatically and continue in normal operation.

I have search for this feature in DHCP Server Manager but there is no option to do this protection method.

How can I do this?


It is be possible to export and import DHCP server configuration using netsh, which is a handy option when migrating the DHCP role from one server to another.

netsh dhcp server export C:\dhcp.txt all
netsh dhcp server import C:\dhcp.txt all

However, there should not normally be such problems when just restarting the DHCP server, and automating the imports might actually cause more misconfigurations than it prevents: you would probably end up restoring an older backup than the current configuration. You should only restore the configuration from backups when you notice there is a problem.