(2014-12-17)
Problem
I have a Windows DHCP server that is reservation-only. I want to duplicate this server's setup on a second server (for redundancy).
Solution
I have a bunch of
unix-like tools for Windows. They are very handy. And they let me do this:
> netsh dhcp server dump | \local\wbin\egrep -i "scope|optionvalue" | \local\wbin\egrep -vi "#|optiondef" | \local\wbin\sed -e "s/Server1/Server2/g" > scope.txt
...which I think you'll agree is a very fine trick.
This dumps server1's current dhcp server configuration and then edits all scope-related configurations such that they can be fed back to netsh to configure server2. It includes the server-level options as well as the scope options and reservations.
The resulting file can be fed back into netsh, where it will send the appropriate commands to configure server2. Note that you can run this on server1 (as long as server2 is accessible).
There's probably a powershell equivalent to this, but I bet it is at least twice as long.
(Based on
this)