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?
 
kuknoConnect With a Mentor Commented:
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
 
andre72Author Commented:
sorry for delay - I'd to wait for responce of my customer ... It works great, thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.