mattw112 Posted October 1, 2009 Posted October 1, 2009 I've found a few past posts where people say they have gotten this working? I'm curious if anyone has a list of commands that don't work when one is in a PE environment (Latest Windows PE that comes with SCCM SP1 R2, 3 maybe) I'm trying to simply query the registry for a value, then write a line to a .inf file. But everytime the Autoit.exe just errors. of course since I'm in the middle of an image build I dont really see what happens, I just see an Error 50 was posted. Which is little help. Here's what I have so far, if anyone has a better way or notices something that wont work in PE let me know. expandcollapse popupGlobal $HAL = "" Global $sHALsource = "C:\WINDOWS\Driver Cache\i386\sp3.cab" Global $sSystem32 = "c:\windows\system32\Unpack" $HAL = RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000", "HardwareID") Select Case $HAL = "acpipic" IniWrite("c:\sysprep\sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIPIC_UP,C:\Windows\Inf\Hal.inf") $sHal = "HALACPI.DLL" $sNtoskrnl = "NTOSKRNL.EXE" $sNkrnlpa = "NTKRNLPA.EXE" Case $HAL = "acpipic_up" IniWrite("c:\sysprep\sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIPIC_UP,C:\Windows\Inf\Hal.inf") $sHal = "HALACPI.DLL" $sNtoskrnl = "NTOSKRNL.EXE" $sNkrnlpa = "NTKRNLPA.EXE" Case $HAL = "acpiapic" If EnvGet("NUMBER_OF_PROCESSORS") > 1 Then IniWrite("c:\sysprep\sysprep.inf", "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\Windows\Inf\Hal.inf") $sHal = "HALMACPI.DLL" $sNtoskrnl = "NTKRNLMP.EXE" $sNkrnlpa = "NTKRPAMP.EXE" Else IniWrite("c:\sysprep\sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:\Windows\Inf\Hal.inf") $sHal = "HALAACPI.DLL" $sNtoskrnl = "NTOSKRNL.EXE" $sNkrnlpa = "NTKRNLPA.EXE" EndIf Case $HAL = "acpiapic_up" If EnvGet("NUMBER_OF_PROCESSORS") > 1 Then IniWrite("c:\sysprep\sysprep.inf", "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\Windows\Inf\Hal.inf") $sHal = "HALMACPI.DLL" $sNtoskrnl = "NTKRNLMP.EXE" $sNkrnlpa = "NTKRPAMP.EXE" Else IniWrite("c:\sysprep\sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:\Windows\Inf\Hal.inf") $sHal = "HALAACPI.DLL" $sNtoskrnl = "NTOSKRNL.EXE" $sNkrnlpa = "NTKRNLPA.EXE" EndIf Case $HAL = "acpiapic_mp" IniWrite("c:\sysprep\sysprep.inf", "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:\Windows\Inf\Hal.inf") $sHal = "HALMACPI.DLL" $sNtoskrnl = "NTKRNLMP.EXE" $sNkrnlpa = "NTKRPAMP.EXE" EndSelect ; Unpack Files DirCreate($sSystem32) Runwait('cmd.exe /c expand ' & '"' & $sHalSource & '"' & ' -f:' & $sHAL & ' ' & $sSystem32) Runwait('cmd.exe /c expand ' & '"' & $sHalSource & '"' & ' -f:' & $sNtoskrnl & ' ' & $sSystem32) Runwait('cmd.exe /c expand ' & '"' & $sHalSource & '"' & ' -f:' & $sNkrnlpa & ' ' & $sSystem32) ; Copy files to System32 FileCopy($sSystem32 & '\' & $sHal, "C:\windows\system32\HAL.dll", 1) FileCopy($sSystem32 & '\' & $sNtoskrnl, "C:\windows\system32\NTOSKRNL.EXE", 1) FileCopy($sSystem32 & '\' & $sNkrnlpa, "C:\windows\system32\NTKRNLPA.EXE", 1) Exit(0) Thanks, Terry
spudw2k Posted October 1, 2009 Posted October 1, 2009 I'm not sure the RegRead will work, because it may or may not be using the system reg file from the hard drive...depending on the PE setup. that's my guess; but I don't know for sure. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
mattw112 Posted October 1, 2009 Author Posted October 1, 2009 Interesting idea. Can you think of anyway to test that or work around it? Some more info though: I am able to stop the deployment using F8 and get a command prompt. From here I was able to launch Regedit and I can see the path and keys I am looking for... I am also able to use the command 'set' to see the variables and I see the number of processors varible in there... Somethign must be causing it to die though I just ran another test I created a blank autoit with just "Exit(0)" in it and compiled and tried that and it failed too... so must not be related to Autoit? Must be something else? Hmm...
mattw112 Posted October 2, 2009 Author Posted October 2, 2009 I figured it out. Apparently no SCCM packages can be ran during a WinPE phase (even though they let you create them and assign them to run at that time). So it wasn't an issue with Autoit at all. Instead of installing through SCCM package I ran from a command line task during the WinPE phase and everything worked fine. Not sure why SCCM wont run a SCCM package, pretty much the same thing as running from a command line? Weird. However I'm still curious if there are commands that wont work in Windows PE... someday when I have more time I'll test it out. Terry
Danny35d Posted October 4, 2009 Posted October 4, 2009 RegRead will work under WinPe. All depent which version of WinPe you are using. You need to load the registry hive located at HardDiskDriverLetter:\Windows\System32\Config they are called SAM, SECURITY, SOFTWARE, and SYSTEM. WinPe 2.0 and lastest already load the registry hive for you just run regedit and look for them. A good learning example is RegEditPe you can download the .exe file or source code. AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
TurionAltec Posted October 4, 2009 Posted October 4, 2009 I believe the poster here is trying to read what HAL WinPE is using (using regread), and modifying the Windows installation on the C: drive to match the hardware (by modifying sysprep.inf, and the HAL files). If anyone is interested in modifying the registry of an offline Windows installation, use the Windows console commands "Reg /load" and "reg /unload" reg load /? Console Registry Tool for Windows - version 3.0 Copyright (C) Microsoft Corp. 1981-2001. All rights reserved REG LOAD KeyName FileName KeyName ROOTKEY\SubKey (local machine only) ROOTKEY [ HKLM | HKU ] SubKey The key name to load the hive file into. Creating a new key FileName The name of the hive file to load You must use REG SAVE to create this file Examples: REG LOAD HKLM\TempHive TempHive.hiv Loads the file TempHive.hiv to the Key HKLM\TempHive
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