Jump to content

Picking correct HAL's from WinPE mode..


Br4tt3

Recommended Posts

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.

Link to comment
Share on other sites


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

Link to comment
Share on other sites

@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.

Link to comment
Share on other sites

@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...

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
Share on other sites

  • 2 weeks later...

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...