Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Picking correct HAL's from WinPE mode..

Featured Replies

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.

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

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

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

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?

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

Doing the same thing to pick ACPI or ACPI MP hal. Works like a charm.

Br4tt3: I replyed at the swedish board too...

  • 3 weeks later...
  • Author

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

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

  • 2 weeks later...

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

  • Author

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

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.

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.