[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2533
  • Last Modified:

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now