Automated creation of DHCP scopes?

  • Thread starter Thread starter Bill Strohm
  • Start date Start date
B

Bill Strohm

I must create approximately 600 scopes on our new network. Is there any way
to create a text file and import it into DHCP? I've looked at the netsh
command but it won't let me specify ranges, etc. Is there some other MS or
third-party tool I've overlooked? Thanks!

Bill Strohm
 
In
Bill Strohm said:
I must create approximately 600 scopes on our new network. Is there
any way to create a text file and import it into DHCP? I've looked
at the netsh command but it won't let me specify ranges, etc. Is
there some other MS or third-party tool I've overlooked? Thanks!

Bill Strohm

Hmm, another non-related DNS question. Must be something wrong with the
newsgroup header?

Anyway, try this:

Create a batch file..

dhcpcmd.exe 192.168.1.200 createsubnet 192.168.1.0 255.255.255.0
computernamehere
rem Example for scope option 006 (DNS):
dhcpcmd.exe 192.168.1.200 setsubnetoptionvalue 192.168.1.0 6 string
"192.168.1.200"
rem etc...

Look in that command's help for more info


--
Regards,
Ace

Please direct all replies to the newsgroup so all can benefit.
This posting is provided "AS IS" with no warranties.

Ace Fekay, MCSE 2000, MCSE+I, MCSA, MCT, MVP
Microsoft Windows MVP - Active Directory
 
Bill Strohm said:
I must create approximately 600 scopes on our new network. Is there any way
to create a text file and import it into DHCP? I've looked at the netsh
command but it won't let me specify ranges, etc. Is there some other MS or
third-party tool I've overlooked? Thanks!

Bill Strohm

Not to encourage off-topic postings, but I must defend the netsh command
shell. I haven't found anything it can't do yet. See the example below for
the creation of a DHCP scope, including ranges, options, reservations, et
al. Get a text file right with everything you want and import it on your
DHCP server with:
netsh -f DHCP_Config.txt
Dump your existing DHCP config with:
netsh dhcp server dump > path\DHCP_Dump_Config.txt

Dhcp Server 192.168.1.20 add scope 192.168.29.0 255.255.255.0 "VLAN_26"
"VLAN_26"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set state 1
# ======================================================================
# Start Add Ipranges to the Scope 192.168.29.0, Server 192.168.1.20
# ======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add iprange 192.168.29.21
192.168.29.254
# ======================================================================
# End Add Ipranges to the Scope 192.168.29.0, Server 192.168.1.20
# ======================================================================
# ======================================================================
# Start Add Excluderanges to the Scope : 192.168.29.0, Server :
172.31.102.74
# ======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 add excluderange 192.168.29.121
192.168.29.155
Dhcp Server 192.168.1.20 Scope 192.168.29.0 add excluderange 192.168.29.39
192.168.29.39
# ======================================================================
# End Add Excluderanges to the Scope : 192.168.29.0, Server :
172.31.102.74
# ======================================================================
# ======================================================================
# Start Add OptionValues to the Scope : 192.168.29.0, Server :
172.31.102.74
# ======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 3 IPADDRESS
"192.168.29.3"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 51 DWORD
"172800"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 6 IPADDRESS
"192.168.1.31" "192.168.1.30"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 44 IPADDRESS
"192.168.1.32" "192.168.1.33"
# ======================================================================
# End Add OptionValues to the Scope : 192.168.29.0, Server :
172.31.102.74
# ======================================================================
# ======================================================================
# Start Add ReservedIp to the Scope : 192.168.29.0, Server :
172.31.102.74
# ======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add reservedip 192.168.29.121
0002557af6e7 "C03486." "" "DHCP"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add reservedip 192.168.29.122
0002551433ef "C01190." "" "DHCP"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add reservedip 192.168.29.123
0060b04daca6 "Res_192.168.29.123" "" "BOTH"
# ======================================================================
# End Add ReservedIp to the Scope : 192.168.29.0, Server :
172.31.102.74
# ======================================================================
 
In
Rick said:
Not to encourage off-topic postings, but I must defend the netsh
command shell. I haven't found anything it can't do yet. See the
example below for the creation of a DHCP scope, including ranges,
options, reservations, et al. Get a text file right with everything
you want and import it on your DHCP server with:
netsh -f DHCP_Config.txt
Dump your existing DHCP config with:
netsh dhcp server dump > path\DHCP_Dump_Config.txt

Dhcp Server 192.168.1.20 add scope 192.168.29.0 255.255.255.0
"VLAN_26" "VLAN_26"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set state 1
#


======================================================================
# Start Add Ipranges to the Scope 192.168.29.0, Server 192.168.1.20
#




======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add iprange
192.168.29.21 192.168.29.254 #
======================================================================
# End Add Ipranges to the Scope 192.168.29.0, Server 192.168.1.20
#
======================================================================
#
======================================================================
# Start Add Excluderanges to the Scope : 192.168.29.0, Server :
172.31.102.74 #
======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 add excluderange
192.168.29.121 192.168.29.155
Dhcp Server 192.168.1.20 Scope 192.168.29.0 add excluderange
192.168.29.39 192.168.29.39
#

======================================================================
# End Add Excluderanges to the Scope : 192.168.29.0, Server :
172.31.102.74 #

======================================================================
#
======================================================================
# Start Add OptionValues to the Scope : 192.168.29.0, Server :
172.31.102.74 #
======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 3
IPADDRESS "192.168.29.3"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 51 DWORD
"172800"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 6
IPADDRESS "192.168.1.31" "192.168.1.30"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 set optionvalue 44
IPADDRESS "192.168.1.32" "192.168.1.33"
#

======================================================================
# End Add OptionValues to the Scope : 192.168.29.0, Server :
172.31.102.74 #

======================================================================
#
======================================================================
# Start Add ReservedIp to the Scope : 192.168.29.0, Server :
172.31.102.74 #
======================================================================
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add reservedip
192.168.29.121 0002557af6e7 "C03486." "" "DHCP"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add reservedip
192.168.29.122 0002551433ef "C01190." "" "DHCP"
Dhcp Server 192.168.1.20 Scope 192.168.29.0 Add reservedip
192.168.29.123 0060b04daca6 "Res_192.168.29.123" "" "BOTH"
#

======================================================================
# End Add ReservedIp to the Scope : 192.168.29.0, Server :
172.31.102.74 #
======================================================================



Rick,
I agree with you about Netsh. I just thought to show him an alternative.

But I like your script much better !

--
Regards,
Ace

Please direct all replies to the newsgroup so all can benefit.
This posting is provided "AS IS" with no warranties.

Ace Fekay, MCSE 2000, MCSE+I, MCSA, MCT, MVP
Microsoft Windows MVP - Active Directory
 
Back
Top