Setup DHCP Server using NETSH

Hi,

I need to setup DHCP Servers automaticelly.
As I found no useful documentation for the API I decide to do with netsh.
This is the script I wrote for:
Dhcp Server 10.95.63.5 add Scope 10.95.63.0 255.255.255.224 "HH-TPC Netz" set state 0
Dhcp Server 10.95.63.5 Scope 10.95.63.0 add iprange 10.95.63.11 10.95.63.30
Dhcp Server 10.95.63.5 Scope 10.95.63.0 set optionvalue 03 IPADDRESS "10.95.63.1"
Dhcp Server 10.95.63.5 Scope 10.95.63.0 set optionvalue 06 IPADDRESS "89.1.5.54" "89.1.5.23"
Dhcp Server 10.95.63.5 Scope 10.95.63.0 set optionvalue 44 IPADDRESS "89.1.5.51"
Dhcp Server 10.95.63.5 Scope 10.95.63.0 set optionvalue 51 DWORD "86400"
Dhcp Server 10.95.63.5 Scope 10.95.63.0 add optiondef 161 "FTP Server" IPADDRESS "10.95.63.5"
Dhcp Server 10.95.63.5 Scope 10.95.63.0 add optiondef 162 "FTP-Pfad" STRING "Wyse"

It works without the last three lines.
The lease time (option 51) is not set right and the last both lines return an error:
DHCP Server Add OptionDef failed.
Parameter(s) passed are either incomplete or invalid.

What the Add Optiondefs should do is shown in the pictures.
Have anybody an idea how to make it working with Windows Server 2003 ?

Thanks,

Andre
opt1.gif
opt1-2.gif
opt2.gif
opt2-1.gif
andre72Asked:
Who is Participating?

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

x
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.

kuknoCommented:
Hi,

use the netsh dump or export command to export the DHCP server config AFTER you have added the optiondef with the GUI. The dump/export will contain the correct netsh commands to recreate the configuration, including the "add optiondef".

Apparently you speak german, so I post the link to the german article in technet: http://technet2.microsoft.com/windowsserver/de/library/df9ecef3-7d85-49e6-a2aa-ff84a5bd3a391031.mspx?mfr=true

Regards
Kurt
0

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
andre72Author Commented:
sorry for delay - I'd to wait for responce of my customer ... It works great, thanks!
0
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.