OSD\_UpdateWindowsHAL
VB Scripting Library > OSD Scripting Library > OSD functions (OSD)
OSD_UpdateWindowsHAL()
Section titled “OSD_UpdateWindowsHAL()”When capturing images of Windows 2000, Windows XP, Windows Server 2003/2003R2, the image only supports the HAL of the source computer. Because of this, mulitible images must be created, one for each HAL that is to be targeted. To avoid this double work, this function detects the target computers Hardware Abstraction Layer (HAL) and insert the necessary files in the target operating system, eliminating the need for multiple images.
Arguments
Section titled “Arguments”No arguments provided.
Return Type
Section titled “Return Type”Boolean, TRUE if function completed successfully.
Remarks
Section titled “Remarks”Typpically used in the PreBootScript.wsf
| ⚠️ NOTE: The captured image must be build using the “Standard PC” or “ACPI Uniprocessor PC” to allow for upgrade. |
Example
Section titled “Example”The following example will update the HAL files to match the computers HAL.
Private Function IncludeScript(sScriptFile) '...End Function
'Begin bStatus=True If bStatus Then bStatus=IncludeScript("customlib.cis") If bStatus Then bStatus=IncludeLibrary("Capalib.cin") If bStatus Then bStatus=IncludeLibrary("Osdlib.cin") If bStatus Then bStatus=Job_Start("WS","Script Name","1.0","ScriptName.log","INSTALL") If bStatus Then bStatus=OSD_Initialize()
If bStatus Then bStatus=OSD_UpdateWindowsHAL()
Job_End(bStatus)'End mainHAL file extraction.
Section titled “HAL file extraction.”The function requires that the different HAL files are available in the “C:\Drivers\HAL” folder on the target computer. These files must be extracted from the installation source media.
To copy the HAL files to the target computer, the HAL folder can be placed in the extras folder for the image found here: <OSD POINT>\Images\<image folder>\Drivers\HAL.
the following script can be used to extract the files and create the needed file structure, in this case from the SP3.cab file from Windows XP.
Sub ExtractFile(sCabFile,sSourceFile,sTargetPath,sTargetFile) Err.Clear dim oFSO : Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(sCabFile) Then If NOT oFSO.FolderExists(sTargetPath) Then oFSO.CreateFolder(sTargetPath) WshShell.Run "expand " & sCabFile & " -F:" & sSourceFile & " " & sTargetPath & "\",0,1 If Err.Number = 0 then oFSO.MoveFile sTargetPath & "\" & sSourceFile, sTargetPath & "\" & sTargetFile End if Else MsgBox "Cab file not found!" End If Set oFSO = NothingEnd sub
Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
Dim sPathToCabDim sTargetPathDim sHALType
sPathToCab = "C:\Extract\sp3.cab"sTargetPath = "C:\Extract\HAL"
sHALType = "\ACPIAPIC_MP" 'ACPI Multiprocessor PCExtractFile sPathToCab,"halmacpi.dll",sTargetPath & sHALType,"hal.dll"ExtractFile sPathToCab,"ntkrnlmp.exe",sTargetPath & sHALType,"ntoskrnl.exe"ExtractFile sPathToCab,"ntkrpamp.exe",sTargetPath & sHALType,"ntkrnlpa.exe"
sHALType = "\ACPIAPIC_UP" 'ACPI Uniprocessor PCExtractFile sPathToCab,"halaacpi.dll",sTargetPath & sHALType,"hal.dll"ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"
sHALType = "\ACPIPIC_UP" 'Advanced Configuration and Power Interface (ACPI) PCExtractFile sPathToCab,"halacpi.dll",sTargetPath & sHALType,"hal.dll"ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"
sHALType = "\HALSP" 'Compaq SystemPro Multiprocessor or 100% CompatibleExtractFile sPathToCab,"halsp.dll",sTargetPath & sHALType,"hal.dll"ExtractFile sPathToCab,"ntkrnlmp.exe",sTargetPath & sHALType,"ntoskrnl.exe"ExtractFile sPathToCab,"ntkrpamp.exe",sTargetPath & sHALType,"ntkrnlpa.exe"
sHALType = "\HALAPIC" 'MPS Uniprocessor PCExtractFile sPathToCab,"halapic.dll",sTargetPath & sHALType,"hal.dll"ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"
sHALType = "\HALMPS" 'MPS Multiprocessor PCExtractFile sPathToCab,"halmps.dll",sTargetPath & sHALType,"hal.dll"ExtractFile sPathToCab,"ntkrnlmp.exe",sTargetPath & sHALType,"ntoskrnl.exe"ExtractFile sPathToCab,"ntkrpamp.exe",sTargetPath & sHALType,"ntkrnlpa.exe"
sHALType = "\HAL" 'Standard PCExtractFile sPathToCab,"hal.dll",sTargetPath & sHALType,"hal.dll"ExtractFile sPathToCab,"ntoskrnl.exe",sTargetPath & sHALType,"ntoskrnl.exe"ExtractFile sPathToCab,"ntkrnlpa.exe",sTargetPath & sHALType,"ntkrnlpa.exe"
Set WshShell = NothingSee Also
Section titled “See Also”