export / manipulat / import DHCP reservations with Windows 2003 DHCP server

Is there a nice way to export DHCP reservations (i.e. fixed assignments MAC -> IP) from W2k3 DHCP server?
The export option I find for *reservations* only exports IP and name, but not the MAC address. When exporting *leases* instead of reservations, all the necessary data *is* exported (apparently without any individual option overrides, but that doesn't matter. OK, this list contains all reservations, so the first part of the task is solved.

Second task:
Manipulate the info as needed - this is also solved as I know how to write perl one-liners :)

Final task:
How to *import* a not so short list of reservations?
This is where I have no idea and you have the opportunity to earn points :)
LVL 20
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve KnightIT ConsultancyCommented:
If you do:

netsh dhcp server \\servername scope x.x.x.x dump | find "reservedip "

In fact the "dump" command gives you ALL the config...  very useful :-)

I used this in some scripts I made for a 100,000+ user network that collected dhcp configs from a list of dhcp servers and that it what was used...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
Sorry for your final part, it is the reverse of dumping it.  If you look at what it dumps it is actually the commandline you need to do an ADD, i.e. this dump is a complete script to re-create the dhcp server:

netsh Dhcp Server Scope Add reservedip 123456789012 "test.domain.local" "" "BOTH"

So easiest way is to add a reservation with the details you want, do an export to get the format then get the commands into a text file as you wish.  We can soon help with some batch scriipts etc. or as you say if you are good with perl should be a doddle.
Take a look at this Microsoft Article: http://support.microsoft.com/kb/325473
thehagmanAuthor Commented:
Steve KnightIT ConsultancyCommented:
Glad you liked it :-)  Kinda helped once I found it too, had been playing around with various other export methods before but this way it is all there in plain text -- we did such things as make sure options were right in all scopes, copy options and reservations from live server to DR servers etc... after all tis just text now.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.