|
| |||||||||
| Tags: 2003, 2008, dhcp, import, onserver, reservations, script |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Script to Import Reservations in DHCP Works on Server 2003 but not onServer 2008
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 ---------------- |
|
#2
| |||
| |||
| Re: Script to Import Reservations in DHCP Works on Server 2003 butnot on Server 2008
On Nov 20, 7:57*am, Greg H <gphal...@gmail.com> wrote: > 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 > > ---------------- You should be able to simply export the DHCP database and import it into the 2008 server. Check the links below for help: http://technet.microsoft.com/en-us/l...87(WS.10).aspx http://blogs.technet.com/networking/...8-machine.aspx Cheers, Matt |
|
#3
| |||
| |||
| Re: Script to Import Reservations in DHCP Works on Server 2003 but not on Server 2008 "Greg H" <gphalpin@gmail.com> wrote in message news:ac9692e3-6b55-4836-a34d-34c5fca68132@k19g2000yqc.googlegroups.com... > 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 > > ---------------- To debug this issue you need to run a command like the one below from the Command Console, then see what happens: netsh dhcp server scope 10.10.0.0 add reservedip 10.10.0.55 02-06-1B-DE-FD-FC |
|
#4
| |||
| |||
| Re: Script to Import Reservations in DHCP Works on Server 2003 butnot on Server 2008
Thanks for the response. That scenario doesn't apply in our situation. We don't have a database to import. We are moving from statically assigned IPs to DHCP (yeah, I know, its 2009 and we are using static IPs. Pretty funny. It's due to Security issues.) We have a spreadsheet of hundreds of IP addresses of computers that currently have static IP addresses. When we switch to DHCP, these computers must have DHCP reservations so they have the same IP addresses everyday instead of random addresses that DHCP normally gives out. It's required for security purposes that the IPs not change on these computers--the security details are too long to get into. Thanks, Greg On Nov 21, 12:23*pm, RemyMaza <remym...@gmail.com> wrote: > On Nov 20, 7:57*am, Greg H <gphal...@gmail.com> wrote: > > > > > 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 > > > ---------------- > > You should be able to simply export the DHCP database and import it > into the 2008 server. *Check the links below for help: > > http://technet.microsoft.com/en-us/l...87(WS.10).aspx > > http://blogs.technet.com/networking/...steps-to-move-... > > Cheers, > Matt |
|
#5
| |||
| |||
| Re: Script to Import Reservations in DHCP Works on Server 2003 butnot on Server 2008
On Nov 23, 9:16*am, Greg H <gphal...@gmail.com> wrote: > Thanks for the response. *That scenario doesn't apply in our > situation. *We don't have a database to import. We are moving from > statically assigned IPs to DHCP (yeah, I know, its 2009 and we are > using static IPs. Pretty funny. *It's due to Security issues.) > > We have a spreadsheet of hundreds of IP addresses of computers that > currently have static IP addresses. *When we switch to DHCP, these > computers must have DHCP reservations so they have the same IP > addresses everyday instead of random addresses that DHCP normally > gives out. *It's required for security purposes that the IPs not > change on these computers--the security details are too long to get > into. > > Thanks, > > Greg > > On Nov 21, 12:23*pm, RemyMaza <remym...@gmail.com> wrote: > > > > > On Nov 20, 7:57*am, Greg H <gphal...@gmail.com> wrote: > > > > 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 > > > > ---------------- > > > You should be able to simply export the DHCP database and import it > > into the 2008 server. *Check the links below for help: > > >http://technet.microsoft.com/en-us/l...87(WS.10).aspx > > >http://blogs.technet.com/networking/...steps-to-move-... > > > Cheers, > > Matt- Hide quoted text - > > - Show quoted text - If the script works for 2003 then run the script on a 2003 DHCP server then export the database and import it into a 2008 server. That should work. It's a few extra steps but it should suffice. Cheers, Matt |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Script to Import Reservations in DHCP Works on Server 2003 but not onServer 2008" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Migrate AD , DNS and DHCP from a Virtual Server 2008 to a New Server 2008 | hassen | Active Directory | 1 | 27-12-2011 11:43 PM |
| How to import list of new DHCP Scopes into Windows Server | ProtocolX | Windows Server Help | 1 | 03-05-2011 01:00 PM |
| Migrating from Server 2003 R2 to Server 2008 R2, issues with logon script and network when old DC is powered down | OctAvio2011 | Operating Systems | 5 | 21-08-2010 12:07 AM |
| how to migrate DHCP settings from server 2003 to server 2008 | Imran | Windows Server Help | 3 | 01-09-2009 01:57 AM |
| How to Import dhcp.txt exported from 2003 into 2008 | Meigs | Windows Server Help | 3 | 11-12-2008 12:27 AM |