Exporting DHCP reservations in Windows Server

Easily the most horrible thing about documenting, migrating, or recreating DHCP scopes in Windows are the DHCP reservations.

I create reservations for anything that is getting a static IP, along with the usual suspects like network printers, APs, and so forth. So on any decent size, flat network this can be a lot of work if you have to recreate or document it manually. This is particularly true when you inherit a network and haven’t been able to document as you go.

I’ll deal with using this data in a later post, but the commands below will give you a list of existing reservations to reference or document.

To start, it’s best if you know the scope (dotted quad) and DHCP server name or IP. Examples below will assume the DHCP server is PHOENIX1, and our scope is 192.168.0.0. All these commands need to be run from an administrative command prompt, and it’s easiest on the DHCP server itself. We’ll save all outputs to txt files in the C:\Temp directory.

If you only care about IP and MAC, use:

netsh dhcp server \\phoenix1 scope 192.168.0.0 show reservedip > C:\Temp\showReservedIP.txt

To get a dump of your entire DHCP scope:

netsh dhcp server \\phoenix1 dump > C:\Temp\scopeDump.txt

Then you can filter that for just the reservations, this time getting most of the useful information including source server, scope, ip, MAC, reservation name and reservation description:

find “reservedip” C:\Temp\scopeDump.txt > C:\Temp\reservations.txt

You can do this in one line, using a pipe.

netsh dhcp server \\phoenix1 dump | find "reservedip" > C:\Temp\reservations.txt
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s