Problem:
WinPE 2.x does not detect the HAL in the same way as WinPE 1.6 did and therefore the HAL replacement in my scripts stopped working.
Resolution:
The following script will detect and copy the proper HAL whether you are using WinPE 1.6 or 2.x for automation. The techniques for detecting the HAL in the script is a modified version of what is described in “ALTIRIS® Deployment Solution™ 6.5 Hardware Independent Imaging v4” best practices document. The script will detect the HAL for both Intel and AMD and systems with multiple processor sockets. The script has been tested against both Lenovo and Dell systems from T41 to the newest desktop (M58p or OptiPlex 760). The script assumes that the image was created using the ACPIAPIC_MP HAL.
HAL detection and replacement script:
REM HAL Check
REM WinPE1.6
REM Check for 'Advanced Configuration and Power Interface (ACPI) PC' (acpipic_up)
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpipic_up"
IF %ERRORLEVEL% EQU 0 GOTO acpipic_up
REM Check for 'ACPI Uniprocessor PC' (acpiapic_up)
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpiapic_up"
IF %ERRORLEVEL% EQU 0 GOTO acpiapic_up
REM Check for 'ACPI Multiprocessor PC' (acpiapic_mp)
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpiapic_mp"
IF %ERRORLEVEL% EQU 0 GOTO DEFAULT
REM WinPE2
REM Check for 'Advanced Configuration and Power Interface (ACPI) PC' (acpipic)
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpipic"
IF %ERRORLEVEL% EQU 0 GOTO acpipic_up
REM Check for 'ACPI Uniprocessor or Multiprocessor PC' (acpiapic)
REG QUERY HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\1 /V VendorIdentifier | Find /I /C "GenuineIntel"
IF %ERRORLEVEL% EQU 0 GOTO DEFAULT
REG QUERY HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\1 /V VendorIdentifier | Find /I /C "AuthenticAMD"
IF %ERRORLEVEL% EQU 0 GOTO DEFAULT
REG QUERY HKLM\SYSTEM\ControlSet001\Enum\Root\ACPI_HAL\0000 /v HardwareId |Find /I /C "acpiapic"
IF %ERRORLEVEL% EQU 0 GOTO acpiapic_up
GOTO END
:acpipic_up
ECHO Copy files for 'Advanced Configuration and Power Interface (ACPI) PC'
.\Rdeploy\Windows\Firm copy .\ drivers\HAL\acpipic_up\HAL.dll prod:\Windows\System32\HAL.dll
.\Rdeploy\Windows\Firm copy .\ drivers\HAL\acpipic_up\ntkrnlpa.exe prod:\Windows\System32\ntkrnlpa.exe
.\Rdeploy\Windows\Firm copy .\drivers\HAL\acpipic_up\ntoskrnl.exe prod:\Windows\System32\ntoskrnl.exe
GOTO END
:acpiapic_up
ECHO Copy files for 'ACPI Uniprocessor PC'
.\Rdeploy\Windows\Firm copy .\drivers\HAL\acpiapic_up\HAL.dll prod:\Windows\System32\HAL.dll
.\Rdeploy\Windows\Firm copy .\drivers\HAL\acpiapic_up\ntkrnlpa.exe prod:\Windows\System32\ntkrnlpa.exe
.\Rdeploy\Windows\Firm copy .\drivers\HAL\acpiapic_up\ntoskrnl.exe prod:\Windows\System32\ntoskrnl.exe
GOTO END
:DEFAULT
ECHO HAL type did not match ACPIPIC_UP or ACPIAPIC_UP, using default (ACPIAPIC_MP)
GOTO END
:END