Br4tt3 Posted April 27, 2006 Share Posted April 27, 2006 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 NextBest RegardsTha Sausage Eater... now eating chorizzos. Link to comment Share on other sites More sharing options...
Jaque Posted April 27, 2006 Share Posted April 27, 2006 I think you just need to do actions below:1) Load the local system hive reg load HKLM\X_System c:\Windows\System32\config\system2) Read registry key HKLM\X_System\ControlSet001\Control\Class\{4D36E966-E325-11CE-BFC1-08002BE10318}\0000\DriverDesc3) Unload the local system hive reg unload HKLM\X_SystemGood luck!Jaque Link to comment Share on other sites More sharing options...
IcemanND Posted April 27, 2006 Share Posted April 27, 2006 @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 More sharing options...
Br4tt3 Posted April 28, 2006 Author Share Posted April 28, 2006 @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 RegardsTha Sausage Eater... Link to comment Share on other sites More sharing options...
p4ntb0y Posted April 30, 2006 Share Posted April 30, 2006 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 More sharing options...
Jazkal Posted May 1, 2006 Share Posted May 1, 2006 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 More sharing options...
mats Posted May 2, 2006 Share Posted May 2, 2006 Doing the same thing to pick ACPI or ACPI MP hal. Works like a charm. Br4tt3: I replyed at the swedish board too... Link to comment Share on other sites More sharing options...
Br4tt3 Posted May 4, 2006 Author Share Posted May 4, 2006 Lo...Works great, thanks alot Mats! Link to comment Share on other sites More sharing options...
Br4tt3 Posted May 22, 2006 Author Share Posted May 22, 2006 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 ExplicitDim objFSO, objFile, strHALVal, strLine, WshShell, CommandSet 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, TrueSet 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 IfLoop Link to comment Share on other sites More sharing options...
Jazkal Posted May 22, 2006 Share Posted May 22, 2006 And just FYI, devcon does not work on WinPE x64. Or at least I can't get it to work. Link to comment Share on other sites More sharing options...
eobiont Posted June 1, 2006 Share Posted June 1, 2006 What about just using TAP.exe to write out the XML file and then read the HAL value out of XML? Link to comment Share on other sites More sharing options...
Br4tt3 Posted June 1, 2006 Author Share Posted June 1, 2006 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 More sharing options...
eobiont Posted June 1, 2006 Share Posted June 1, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now