Scripting.FileSystemObject
(1)
IpList.AtEndOfStream
(1)
Wscript.CreateObject
(1)
Wscript.Shell
(1)
IpList.readLine
(1)
Windows
(1)
IpList
(1)
RLine
(1)

Import DHCP Reservations Windows 2008

Asked By Greg H
19-Nov-09 06:17 PM
We need to import hundreds of DHCP reservations into our DHCP server
with the IP, name, type, MAC address.  We have a script that worked
with 2003, importing the IP and MAC address but it does not work with
Windows 2008.

Below is our script.  Does anyone have one that works with 2008 or can
help us modify our existing script?

Thanks.

----
Set fso = Wscript.CreateObject

("Scripting.FileSystemObject")

Set shell = Wscript.CreateObject("Wscript.Shell")

Set ipList=fso.OpenTextFile("c:\ListFile.txt", 1, false)

Do While not ipList.AtEndOfStream
rLine=Trim(ipList.readLine)
MAC = Right(rLine, Len(rLine) - InStrRev(rLine, ","))
IP = Left(rLine, InStrRev(rLine, ",") - 1)
If not IP = "" or MAC = "" then
shell.run "netsh dhcp server scope 10.10.0.0 add



reservedip " & IP & " " & MAC, 0, True

End If
Loop

-----------------
Post Question To EggHeadCafe