MSFN Forum: Picking correct HAL's from WinPE mode.. - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Picking correct HAL's from WinPE mode.. Cant get the WMI to work, need CLI... Rate Topic: -----

#1 User is offline   Br4tt3 

  • World famous sausage eater...
  • PipPipPipPip
  • Group: Members
  • Posts: 566
  • Joined: 20-April 04

Posted 27 April 2006 - 02:18 AM

Hi folks..

So, here it is:

I want to be able to run a query against machine(s) when running in WinPE mode to obtain the correct HAL to use when I later on the process have to pick an image to apply. I written a WMI query which succesfully works in a full Windows XP environment, which features the full WMI repository. However, running the same script from within WinPE mode, it just returns jack ****. And Yes, I have enabled / added WMI to my WinPE image as I can run wbemtest and so on...

So, if WMI doesnt work correctly for picking the HAL, then maby u guys know of some CLI tool that will do the trick for me? or maby have suggestion to the WMI code used to obtain the HAL?

Here is the actual WMI query:

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity where ClassGuid = '{4D36E966-E325-11CE-BFC1-08002BE10318}'",,48)
For Each objItem in colItems
strHALname = objItem.Name
Next

Best Regards
Tha Sausage Eater... now eating chorizzos.


#2 User is offline   Jaque 

  • Group: Members
  • Posts: 7
  • Joined: 24-March 05

Posted 27 April 2006 - 01:33 PM

I think you just need to do actions below:

1) Load the local system hive
reg load HKLM\X_System c:\Windows\System32\config\system

2) Read registry key
HKLM\X_System\ControlSet001\Control\Class\{4D36E966-E325-11CE-BFC1-08002BE10318}\0000\DriverDesc

3) Unload the local system hive
reg unload HKLM\X_System


Good luck!
Jaque

#3 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,239
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 27 April 2006 - 03:38 PM

@Jaque - That will tell you what HAL was installed on an existing OS on the hard drive. But one has to be installed and it would have had to been the correct one to be of any help.

So if all of those conditions are true then that would work beautifully. But if you're trying to restore an image to a machine you've just replaced the hard drive in it's not going to help much.

I've been looking to do the same sort of thing, either from PE or DOS but as of yet have not found a way to do it.

#4 User is offline   Br4tt3 

  • World famous sausage eater...
  • PipPipPipPip
  • Group: Members
  • Posts: 566
  • Joined: 20-April 04

Posted 28 April 2006 - 12:37 AM

View PostIcemanND, on Apr 27 2006, 03:38 PM, said:

@Jaque - That will tell you what HAL was installed on an existing OS on the hard drive. But one has to be installed and it would have had to been the correct one to be of any help.

So if all of those conditions are true then that would work beautifully. But if you're trying to restore an image to a machine you've just replaced the hard drive in it's not going to help much.

I've been looking to do the same sort of thing, either from PE or DOS but as of yet have not found a way to do it.


I will definitly look into it.... would be nice to pick the HAL externally to the setup. MS and their SMS OSD picks it from a database (I think), and they just run a ADO connection to that DB to fetch the correct HAL from an audit or something. But that is cheating!

Best Regards
Tha Sausage Eater...

#5 User is offline   p4ntb0y 

  • Member
  • PipPip
  • Group: Members
  • Posts: 237
  • Joined: 14-February 06

Posted 30 April 2006 - 12:40 PM

Using WMI to detect the HAL doesn't work too well under Windows PE
because PE always uses the same HAL regardless of the hardware.

How about you use manufacturer and model as you must know the hal status for these?

#6 User is offline   Jazkal 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 590
  • Joined: 16-January 04

Posted 01 May 2006 - 10:10 AM

I use devcon to parse out the devices on the system, then compare to a database, to figure out what image to use.

I wanted to use the manufacturer and model, but we have white box servers we have to support (without this info). So we used devcon.

If you have all branded hardware, the manufacturer and model idea is a good one (IMO).

#7 User is offline   mats 

  • Member
  • PipPip
  • Group: Members
  • Posts: 206
  • Joined: 10-May 05

Posted 02 May 2006 - 01:32 AM

Doing the same thing to pick ACPI or ACPI MP hal. Works like a charm.
Br4tt3: I replyed at the swedish board too...

#8 User is offline   Br4tt3 

  • World famous sausage eater...
  • PipPipPipPip
  • Group: Members
  • Posts: 566
  • Joined: 20-April 04

Posted 04 May 2006 - 01:25 AM

Lo...

Works great, thanks alot Mats!

#9 User is offline   Br4tt3 

  • World famous sausage eater...
  • PipPipPipPip
  • Group: Members
  • Posts: 566
  • Joined: 20-April 04

Posted 22 May 2006 - 08:12 AM

Spoke with MS about it... they encourage you to actually read the registry key (rather than to have WMI query the same key) and then base your decision from the return. So far, tried it on 3 diffrent HAL's where as the decision always seem to work based on the WinPE key. For example, using Mats & Jazkal's suggestion: (assuming devcon.exe is on ur WinPE image) or u could do a normal regread..

Option Explicit
Dim objFSO, objFile, strHALVal, strLine, WshShell, Command

Set WshShell = WScript.CreateObject("WScript.Shell")

'Syntax for the Devcon.exe command from .vbs - "Devcon hwids find " & """@root\*hal*"""
Command = "cmd /c Devcon hwids find " & """@root\*hal*""" & " > c:\HAL.txt"
WshShell.Run Command, 0, True

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\HAL.txt", 1)

Do WHile Not objFile.AtEndOfStream
strLine = objFile.ReadLine()
If Left( trim (strLine), 5) = "Name:" Then
strHALVal = Mid(strLine, 10)
End If
Loop

#10 User is offline   Jazkal 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 590
  • Joined: 16-January 04

Posted 22 May 2006 - 02:26 PM

And just FYI, devcon does not work on WinPE x64. Or at least I can't get it to work.

#11 User is offline   eobiont 

  • Group: Members
  • Posts: 3
  • Joined: 26-February 04

Posted 31 May 2006 - 10:06 PM

What about just using TAP.exe to write out the XML file and then read the HAL value out of XML?

#12 User is offline   Br4tt3 

  • World famous sausage eater...
  • PipPipPipPip
  • Group: Members
  • Posts: 566
  • Joined: 20-April 04

Posted 01 June 2006 - 04:45 AM

Is that .exe free to use then? All I can find on google is something about the embedded XP which I dont have... or is included with the SA agreement aswell?

Tha Sausage Eater...

#13 User is offline   eobiont 

  • Group: Members
  • Posts: 3
  • Joined: 26-February 04

Posted 01 June 2006 - 07:47 AM

Re: TAP.EXE

I'll leave the investigative work up to you. the Microsoft's MSDN site does talk about how to use it with WinPE. This sort-of implies that it is available to use with WinPE. It is a free-to-download application that is part of the WindowsXPe utilities. If you download it, I'm sure there is a license agreement that acompanies the application - perhaps reading that would be appropriate.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy