myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


WinPE and multiple static IPs

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Management Products] >> Windows PE >> WinPE and multiple static IPs Page: [1]
Login
Message << Older Topic   Newer Topic >>
WinPE and multiple static IPs - 8/31/2005 1:10:02 PM   
jsmyth

 

Posts: 14
Score: 0
Joined: 10/1/2002
Status: offline
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
Post #: 1
RE: WinPE and multiple static IPs - 8/31/2005 2:15:12 PM   
pdavey


Posts: 172
Score: 11
Joined: 5/6/2004
From: Surrey, United Kingdom
Status: offline
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!




_____________________________

---------------------------------
Paul Davey
Email:- Paul.E.Davey@atkinsglobal.co.uk
MSN IM: Pauledavey@hotmail.com
----------------------------------

(in reply to jsmyth)
Post #: 2
RE: WinPE and multiple static IPs - 8/31/2005 11:34:29 PM   
dthomson


Posts: 1382
Score: 223
Joined: 6/20/2001
From: Eastern Shore Maryland, USA
Status: offline
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.

_____________________________

Dan

Please rate my post

My blog
My articles
Code Repository

(in reply to jsmyth)
Post #: 3
RE: WinPE and multiple static IPs - 9/1/2005 8:24:52 AM   
jsmyth

 

Posts: 14
Score: 0
Joined: 10/1/2002
Status: offline
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

(in reply to jsmyth)
Post #: 4
RE: RE: WinPE and multiple static IPs - 9/8/2005 11:11:16 PM   
dthomson


Posts: 1382
Score: 223
Joined: 6/20/2001
From: Eastern Shore Maryland, USA
Status: offline
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.

Attachment (1)

< Message edited by dthomson -- 9/8/2005 11:11:52 PM >


_____________________________

Dan

Please rate my post

My blog
My articles
Code Repository

(in reply to jsmyth)
Post #: 5
RE: WinPE and multiple static IPs - 9/12/2005 9:21:40 AM   
jsmyth

 

Posts: 14
Score: 0
Joined: 10/1/2002
Status: offline
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

(in reply to jsmyth)
Post #: 6
RE: WinPE and multiple static IPs - 9/13/2005 4:41:52 AM   
pdavey


Posts: 172
Score: 11
Joined: 5/6/2004
From: Surrey, United Kingdom
Status: offline
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

_____________________________

---------------------------------
Paul Davey
Email:- Paul.E.Davey@atkinsglobal.co.uk
MSN IM: Pauledavey@hotmail.com
----------------------------------

(in reply to jsmyth)
Post #: 7
RE: WinPE and multiple static IPs - 8/31/2006 5:17:19 PM   
fatboyevi

 

Posts: 1
Score: 0
Joined: 8/31/2006
Status: offline
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

(in reply to pdavey)
Post #: 8
Page:   [1]
All Forums >> [Management Products] >> Windows PE >> WinPE and multiple static IPs Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.516