Greg H
2009-11-20 14:57:48 UTC
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
----------------
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
----------------