WinPE and multiple static IPs (Full Version)

All Forums >> [Management Products] >> Windows PE



Message


jsmyth -> WinPE and multiple static IPs (8/31/2005 1:10:02 PM)

OK, we have a huge deployment of XP sp2 that is almost ready to start. Problem is, at the 280+ locations this will take place at, each runs a unique static IP (first 3 octets are unique to the location). The WinPE v2004 I created runs with DHCP which is NOT available at any of the locations. I am really not looking to create 280+ unique winPE builds.

Is there a way anyone knows of that I can maybe have the winPE disk query for the IP address?
Or possibly redirect it to a different location for the winbom.ini so I can provide one with the specific location network info?

And finally, how do I build the specific IP info in to the winbom.ini?
Anyone have any examples?

Am I missing something easy? Am I making this too hard? Please let me know!

Ok, I am taking a deep breath.
Thanks for anyone that provides anything (inclucing medication!).
Jen




pdavey -> RE: WinPE and multiple static IPs (8/31/2005 2:15:12 PM)

Jen,

Could be too much of a manual process for you, but: have a look here http://www.geocities.com/pierremounir/

This is a good tool with which you can set the IP config on the machine within Windows PE on the fly.

Have a go and let me know if this helps. Otherwise, we might be able to script something, but not too sure how yet!






dthomson -> RE: WinPE and multiple static IPs (8/31/2005 11:34:29 PM)

Hi Jen,

I don' t think I can help with medication, but I can help with some thoughts on a process.

I know exactly what you want and how to get there, but I need to put it together for posting. It won' t have any code, but it will explain the needed framework to get the job done.

Sit tight, take your meds [:)], and I' ll get something posted in a day or so.




jsmyth -> RE: WinPE and multiple static IPs (9/1/2005 8:24:52 AM)

This site always comes thru for me. Thanks for the postings and suggestions.
Sometimes it isn' t the most fun being a contractor in a Fed. Gov. office. Seems like everyone has these ' ideas' and only a few people are actually ' the worker bees' .

I' m looking into Paul' s suggestion and anxiously awaiting a post from Dan.
Thanks to all.
Jen




dthomson -> RE: RE: WinPE and multiple static IPs (9/8/2005 11:11:16 PM)

Here you go. I ended up writing some code [:)]

On Error Resume Next

' Some constants

' HKLM used for WMI
Const HKEY_LOCAL_MACHINE = &H80000002

' Name of the WinPE WinBom.ini file which is to be created.
Const WinBom_File = " C:\WinBom.ini" 

Set objFSO      = CreateObject(" Scripting.FileSystemObject" )
Set objWshShell = CreateObject(" Wscript.Shell" )
Set objWMIRegistry = GetObject(" winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv" )

' Load the system registry hive
objWshShell.Run " Reg.exe LOAD HKLM\TempHive C:\Windows\System32\Config\System" , 0, True

' Enum the specified registry key
objWMIRegistry.EnumKey HKEY_LOCAL_MACHINE, " TempHive\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}" , arrSubKeys

' Loop through the returned array and find the network card
For Each subkey In arrSubKeys
  strSubKey = " TempHive\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\"  & subkey

  intType = Null

  ' Is this item a nic?
  intResult = objWMIRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strSubKey, " BusType" , intType)

  If intType = 5 Then
      intResult = objWMIRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strSubKey, " NetCfgInstanceId" , strValue)

      strSubKey = " TempHive\ControlSet001\Services\Tcpip\Parameters\Interfaces\"  & strValue

      ' Determine if DHCP is in use
      intResult = objWMIRegistry.GetDWordValue(HKEY_LOCAL_MACHINE, strSubKey, " EnableDHCP" , intValue)

      If intValue = 0 Then
        ' Static IP Addressing is being used. Let' s get the IP, Subnet Mask, and Gateway
        blnDHCP = False
        objWMIRegistry.GetMultiStringValue HKEY_LOCAL_MACHINE, strSubKey, " IPAddress" , arrIP
        objWMIRegistry.GetMultiStringValue HKEY_LOCAL_MACHINE, strSubKey, " SubnetMask" , arrSubnet
        objWMIRegistry.GetMultiStringValue HKEY_LOCAL_MACHINE, strSubKey, " DefaultGateway" , arrGateway
      Else
        blnDHCP = True
      End If
  End If
Next

' Unload the system registry hive
objWshShell.Run " Reg.exe UNLOAD HKLM\TempHive" , 0, True


' Create the WinBom.ini file
Set objFile = objFSO.OpenTextFile(WinBom_File, 2, True)

objFile.WriteLine " [Factory]" 
objFile.WriteLine " WinBOMType=WinPE" 
objFile.WriteLine " Reseal=No" 
objFile.WriteLine " [WinPE]" 
objFile.WriteLine " Restart=No" 
objFile.WriteLine " [PnPDriverUpdate]" 
objFile.WriteLine " [PnPDrivers]" 
objFile.WriteLine " [NetCards]" 
objFile.WriteLine " [UpdateInis]" 
objFile.WriteLine " [FactoryRunOnce]" 
objFile.WriteLine " [Branding]" 
objFile.WriteLine " [AppPreInstall]" 

' Add the static IP data?
If NOT blnDHCP Then
  objFile.WriteLine " [WinPE.Net]" 
  objFile.WriteLine " Gateway = "  & Join(arrGateway, " ," )
  objFile.WriteLine " IPConfig = "  & Join(arrIP, " ," )
  objFile.WriteLine " StartNet = Yes" 
  objFile.WriteLine " SubnetMask = "  & Join(arrSubnet, " ," )
End If

objFile.Close
Set objFile = Nothing
Some details:
If you are running WinPE from a cd or iso, then you will need to add a RAM Disk to your WinPE build and update the WinBom_File constant in the script to have the script put the WinBom file on the RAM Disk. This is due to the fact that WinPE booted from iso or cd does NOT have a writable file system.

You will need to modify the WinBom.ini file(s) which are in your WinPE build to point to the alternate WinBom.ini file which is specified by the WinBom_File constant and subsequently created by this script. The modified WinBom.ini file will look something like this:
[Factory]
WinBOMType=WinPE
Reseal=No
NewWinbom = C:\winbom.ini
[WinPE]
Restart=No
[PnPDriverUpdate]
[PnPDrivers]
[NetCards]
[UpdateInis]
[FactoryRunOnce]
[Branding]
[AppPreInstall]
See the Windows Preinstallation Environment User' s Guide for assistance on modifying the WinBom.ini file.

HTH

Let me know if you have questions.

P.S. I have attached the script to this post.




jsmyth -> RE: WinPE and multiple static IPs (9/12/2005 9:21:40 AM)

Big thanks to Paul and Dan!
Paul, I used your suggestion, and once I worked through a few kinks, it works great (I was trying to make it harder then it really is).

Dan, you amaze me. Thanks for the code. I will be working with it to learn from it.
Jen




pdavey -> RE: WinPE and multiple static IPs (9/13/2005 4:41:52 AM)

No problems glad it helped.
Dan, this code is really useful for a lot of people. If you would like to start a new topic and copy the code in to it, with a brief explanation, I will pin it for other people to make use of.

thanks

Paul




fatboyevi -> RE: WinPE and multiple static IPs (8/31/2006 5:17:19 PM)

Hi Dan
I'm new to vbs. I'd like to use your script to set ip addresses for WinPE on the fly, what steps do I need to take to do that? Thanks a lot!

Kenny




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.28125