Handling HAL switching during XP deployment (no BSOD /0x07 error)

 

Because of the issue with different HAL’s (Hardware Abstraction Layer) used by XP, it is necessary to make some changes to both Sysprep, and the Kernel files during deployment..

I thought I’d supply my HAL changing script, as it does not require the reference computer to be build  from a specific ACPI structure , and you do not need to add any files to the image beforehand, as it’s done by the script.

Just run the script after the image has been deployed, but before booting from WinPE to the MiniSetup

<job id="HAL">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">
‘ //***************************************************************************
‘ // ***** Script Header *****
‘ //
‘ // Purpose: Change HAL
‘ //
‘ // Prerequsits: The refrence image must be SP2 or SP3
‘ //
‘ // Coretech History:
‘ // 1.0.0     Michael Petersen 19/09/2008  Created initial version.
‘ //
‘ // ***** End Header *****
‘ //***************************************************************************

‘//—————————————————————————-
‘// Global constant and variable declarations
‘//—————————————————————————-

Option Explicit

Dim iRetVal, sHalType, sLocalDrive, sHalSource, sSysprep, sfile, sSystem32, sHal, sNtoskrnl, sNkrnlpa

‘//—————————————————————————-
‘// End declarations
‘//—————————————————————————-

‘//—————————————————————————-
‘// Main routine
‘//—————————————————————————-

On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0

‘//—————————————————————————
‘//
‘// Function: ZTIProcess()
‘//
‘// Input: None
‘//
‘// Return: Success – 0
‘// Failure – non-zero
‘//
‘// Purpose: Perform main ZTI processing
‘//
‘//—————————————————————————
Function ZTIProcess()

iRetVal = Success

ZTIProcess = iRetval

‘ Check for Sysprep.inf and set Path
sLocalDrive = oEnvironment.Item("OSDTargetSystemDrive")  

If oFSO.fileExists(sLocalDrive & "sysprepSysprep.inf") then
    sSysprep = sLocalDrive & "sysprepSysprep.inf"
    oLogging.CreateEntry "Found sysprep in " & sSysprep, LogTypeInfo
Else
     oLogging.CreateEntry "Could not locate Sysprep", LogTypeWarning
End if

‘Set HAL source path from sp2 or sp3
If oFSO.fileExists(sLocalDrive & "WINDOWSDriver Cachei386sp3.cab") then
    sHALsource = sLocalDrive & "WINDOWSDriver Cachei386sp3.cab"
    oLogging.CreateEntry "HAL replasment files will come from: " & sHALsource, LogTypeInfo
elseIf oFSO.fileExists(sLocalDrive & "WINDOWSDriver Cachei386sp2.cab") then
    sHALsource = sLocalDrive & "WINDOWSDriver Cachei386sp2.cab"
    oLogging.CreateEntry "HAL replasment files will come from: " & sHALsource, LogTypeInfo
else
    oLogging.CreateEntry "no HAL replasment fileses present", LogTypeInfo
end if

‘Get the HAL type from the registry (from Windows PE).  This will tell us if we are running on a PIC or an APIC chipset.
    oLogging.CreateEntry "Configuring HAL replacement", LogTypeInfo
    sHalType = oShell.RegRead("HKLMSYSTEMCurrentControlSetEnumRootACPI_HAL000HardwareID")
    oLogging.CreateEntry "Windows PE is using HAL " & sHalType(0), LogTypeInfo  

            
Select Case lCase(sHalType(0))
Case "acpipic", "acpipic_up"
    ‘Add the UpdateUPHAL command to the Sysprep.inf file.
    oUtility.WriteINI "C:SysprepSysprep.inf", "Unattended", "UpdateUPHAL", "ACPIPIC_UP,C:windowsInfHal.inf"
    oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor PIC HAL", LogTypeInfo
    ‘Configure HAL and Krnl
    sHal = "HALACPI.DLL"
    sNtoskrnl = "NTOSKRNL.EXE"
    sNkrnlpa = "NTKRNLPA.EXE"

Case "acpiapic", "acpiapic_up"
    if oShell.Environment.item("NUMBER_OF_PROCESSORS") > 1 then
    ‘If Processors.Count > 1 Then’Add the UpdateHAL command to the Sysprep.inf file.
        oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:windowsInfHal.inf"
        oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo
        ‘Configure HAL and Krnl
        sHal = "HALMACPI.DLL"
        sNtoskrnl = "NTKRNLMP.EXE"
        sNkrnlpa = "NTKRPAMP.EXE"   
    Else
        ‘Add the UpdateUPHAL command to the Sysprep.inf file.
        oUtility.WriteINI sSysprep, "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,C:windowsInfHal.inf"
        oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with uniprocessor APIC HAL", LogTypeInfo
        ‘Configure HAL and Krnl
        sHal = "HALAACPI.DLL"
        sNtoskrnl = "NTOSKRNL.EXE"
        sNkrnlpa = "NTKRNLPA.EXE"
    End If

Case "acpiapic_mp"
    ‘Add the UpdateHAL command to the Sysprep.inf file.
    oUtility.WriteINI sSysprep, "Unattended", "UpdateHAL", "ACPIAPIC_MP,C:windowsInfHal.inf"
    oLogging.CreateEntry "Updated SYSPREP.INF to replace HAL with multiprocessor APIC HAL", LogTypeInfo   
    ‘Configure HAL and Krnl
    sHal = "HALMACPI.DLL"
    sNtoskrnl = "NTKRNLMP.EXE"
    sNkrnlpa = "NTKRPAMP.EXE"
End Select       

‘Check if System32 is present and unpack needed files.
sSystem32 = sLocalDrive  & "WindowsSystem32"
oLogging.CreateEntry "Checking for access to " & sSystem32, LogTypeInfo

If oFSO.FolderExists(sSystem32) then
    oLogging.CreateEntry sSystem32 & " Found", LogTypeInfo

    For Each sFile in Array(sHal,sNtoskrnl,sNkrnlpa)
        oShell.Run "expand " & Chr(34) & sHalSource & Chr(34) & " -f:" &sFile & " " &sSystem32,0,true
        oLogging.CreateEntry "Copying " & sFile & " to " & sSystem32, LogTypeInfo

    Next
        oFSO.CopyFile sSystem32 &sHal, sSystem32 & "HAL.dll", true
        oFSO.CopyFile sSystem32 &sNtoskrnl, sSystem32 & "NTOSKRNL.EXE", true
        oFSO.CopyFile sSystem32 &sNkrnlpa, sSystem32 & "NTKRNLPA.EXE", true
        oLogging.CreateEntry "rename HAL and Kernal files", LogTypeInfo
    Else
        oLogging.CreateEntry "Error – Folder " & sSystem32 & " Not Found", LogTypeError
End If
End Function
</script>
</job>

 

Get the script here.

http://cid-eeff1607e296e5ab.skydrive.live.com/embedrow.aspx/Script/HAL.wsf

 

Advertisements
This entry was posted in SCCM. Bookmark the permalink.

10 Responses to Handling HAL switching during XP deployment (no BSOD /0x07 error)

  1. Mesut says:

    First of all I would like to thank you for creating this script. At the moment I busy setting up a MDT 2008/SCCM 2007 R2 environment and would like to have 1 Windows XP image that supports both UP and MP HAL. prefer not to use the script of Johan as it requires that you have build the ref image on a Advanced ACPI hal machine which doesn’t make sense to me.Unfortunatly, your script does not work for me. I have added the HAL.WSF file to the tasksequnce right after "Install Operating System" and I know for sure that it gets executed because it creates a log file HAL.txt that contains this info.In the log file it looks like everything is succesfull, it detects that it is a UP HAL (which is correct) but the deployed machine dies after having installed the OS and rebooted. Starting from SafeMode shows me that it hangs on MUP.sys, then blue screen followed by restart, infinite loop. For sure a HAL issue.Can you please have a look at this info and let me know if you can see why it is not working:<![LOG[The task sequencer log is located at X:\windows\TEMP\SMSTSLog\SMSTS.LOG. For task sequence failures, please consult this log.]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Found sysprep in C:\sysprep\Sysprep.inf]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[HAL replasment files will come from: C:\WINDOWS\Driver Cache\i386\sp3.cab]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Configuring HAL replacement]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Windows PE is using HAL acpipic]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Updated SYSPREP.INF to replace HAL with uniprocessor PIC HAL]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Checking for access to C:\Windows\System32\]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[C:\Windows\System32\ Found]LOG]!><time="11:44:15.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Copying HALACPI.DLL to C:\Windows\System32\]LOG]!><time="11:44:16.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Copying NTOSKRNL.EXE to C:\Windows\System32\]LOG]!><time="11:44:17.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[Copying NTKRNLPA.EXE to C:\Windows\System32\]LOG]!><time="11:44:18.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[rename HAL and Kernal files]LOG]!><time="11:44:18.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL"><![LOG[HAL processing completed successfully.]LOG]!><time="11:44:18.000+000" date="05-14-2009" component="HAL" context="" type="1" thread="" file="HAL">

  2. Fred says:

    Hey, I had been using this script with great success in MDT 2008. When I migrated to MDT 2010 I still had a few Windows XP machines that suffered HAL problems so I loaded this script again. It didn’t work. After poking around for a while, I found that the variable "DeploySystemDrive" does not appear to exist in 2010. I hacked the script by replacing the line:sLocalDrive = oEnvironment.Item("DeploySystemDrive") withsLocalDrive = "c:"Of course if you’re not using c: as your system drive, you’re going to have to change that but, my bet is most are.Hope that helps. Maybe there is another variable that can be substituted in there for more reliable results.Thanks for the script Michael. It saves a lot of my machines from HAL death!

  3. Travis says:

    As Fred Beck wrote "oEnvironment.Item("DeploySystemDrive") " is deprecated in MDT 2010. Instead I found oEnvironment.Item("DESTINATIONLOGICALDRIVE") works as a replacement. Much better than pointing to a static path (i.e. c:\)

  4. Dietmar says:

    It’s possible to add a custom OSD Varibale like ‘OSDisk’ or anything else in ‘Format and Partition Disk’ task sequence action. You can use this varibale, too.

  5. Unknown says:

    This blog is very informative. I love blogging when it is for or about something I believe in. I also read news blogs often and find that it makes me feel more intelligent every time I read them. I also feel like I am a pretty good person who tries to treat others with respect, no matter what their opinion is. There are some real haters out there. Thanks again. I learned a few things about blogging. I will definitely put your site on my speed dial.Thanks http://www.vanjobb.huhttp://www.vanjobb.hu/mobilinternet.php?11http://www.vanjobb.hu/Bankbetetkamatok.php?22http://www.vanjobb.hu/nevnapokdatumszerint.php?39http://www.vanjobb.hu/nevnapoknaptar.php?41http://www.vanjobb.hu/nevnapok.php?40

  6. Tiago says:

    ..as I run. wsf file in task sequencer….help me please.

  7. Tiago says:

    I made the image of windows xp sp3, and I need to install on three different computers, as I use this script to automatically modify the hal…

  8. Tiago says:

    kongkuba are you there/?

  9. This script works perfectly for deploying one XP image to computers with Intel or AMD processors. No need to copy files, edit sysprep etc.
    Just run this script from the MDT 2010 task sequence. Add it to the Task Sequence after “Post install” before “Next phase”.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s