Home > Batch Scripting, Scripting, Windows Server > Export DHCP Reservations with Mac addresses:

Export DHCP Reservations with Mac addresses:

I had difficulty recently with our DHCP reservations, namely i coudnt export the MAC addresses included in the reservation and the mmc was only allowing very limited as I could only export the ip address and the FQDN of the computer owner.

After a bit of rummaging i found an entry for DCHP in netsh. I found that you could dump the DHCP server settings to a text file. This included every server setting aswell as the reservations. I then filtered the exported file for “Add reservedip” using the find command to export a csv file with just the reservations.

Once i had the file in csv, i simply imported it into an excel sheet using spaces as the delimiter and hey presto a lovely little reservation report:

Same rules as always, dont run it from a UNC path, copy it local to the DHCP server and run it there.

netsh dhcp server dump >> reservationdump.txt
find “Add reservedip” reservationdump.txt >> reservations.csv

You can download the script as is here:

  1. Spuggy
    June 17, 2008 at 12:40 pm

    Cheers for that mate worked a treat and speeded up what would have been very boring task 🙂

  2. Michael
    July 22, 2008 at 2:03 am

    awesome mate thanks alot, worked perfectly.

  3. Todd
    October 28, 2008 at 3:35 pm

    Your download doesn’t work anymore, just so you know.

  4. Andrew Morgan
    October 28, 2008 at 4:06 pm

    Hi Todd,

    I’ve updated the download link as per your notice, seems 4shared don’t allow .bat downloads anymore 😦

  5. Adam
    July 16, 2010 at 1:15 am

    Cheers!

    worked perfectly, saved me tons of time!

  6. March 29, 2011 at 9:19 pm

    Lovey blog and information..

  7. October 24, 2012 at 7:14 am

    Hey! I hope you do not mind but I decided to submit your weblog: http://andrewmorgan.ie/2008/05/26/export-dhcp-reservations-with-mac-addresses/ to my internet directory website. I used, “Export DHCP Reservations with Mac addresses: AndrewMorgan.ie” as your weblog title. I hope this is alright with you. In the event you’d like me to change the title or perhaps remove it completely, email me at ashleyfite@yahoo.de. Thank you.

  1. No trackbacks yet.

Leave a comment