I received the error message "An error occurred while accessing the DHCP database. Look at the DHCP server event log for more information on this error" when administering DHCP this afternoon.

It took me ages to track down what the problem was - the clue was that I was adding a DHCP reservation; every time I clicked on "Add" I got the error message.

To troubleshoot it I wanted to get an export or dump of all the entries and configuration of DHCP on the server. After a bit of Googling I came across this:

netsh dhcp server <IP address> dump >u:\dhcpdump.txt

But the first time I ran the command I got the output

The following command was not found: dhcp server <IP address> dump

The answer is to issue the command:

netsh add helper dhcpmon.dll

You just have to do it once - and then netsh will know about the DHCP commands you can use.

N.B. <IP address> has to be the IP address of the DHCP server. It can't lookup the server from the hostname

 

As for my problem; searching for the MAC address I was trying to use highlighted the issue. A single MAC address cannot be reserved twice in a scope. Unfortunately the error message I was getting wasn't explicit enough (and I don't have the rights to look at the logs on the DCs).