I don't know about anyone else but I use the following script. It runs after the WIM has been copied to C:\ and updates sysprep.inf with the information for the appropiate HAL. So far it hasn't failed me yet.
CODE
'On Error Resume Next
Set objWshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Activate the partition
Call ActivateDisk()
' Customize the local sysprep.inf file based on the HAL type
Call UpdateSysprepinf ()
' Done, quit.
WScript.Quit
Sub ActivateDisk()
' Wait a few seconds, assign drive letter and activate
wscript.sleep 5000
cmd = "cmd /c diskpart.exe /s Activate.txt"
rc = objWshShell.run(cmd, 6, 1)
End Sub
Sub UpdateSysprepinf ()
' Find out the HAL type
sHalType = objWshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Enum\Root\ACPI_HAL\0000\HardwareID")
' Write HAL type to sysprep.inf
If sHalType(0) = "acpiapic_up" Then
WriteIni "c:\sysprep\sysprep.inf", "Unattended", "UpdateUPHAL", "ACPIAPIC_UP,%WINDIR%\Inf\Hal.inf"
ElseIf sHalType(0) = "acpiapic_mp" Then
WriteIni "c:\sysprep\sysprep.inf", "Unattended", "UpdateHAL", "ACPIAPIC_MP,%WINDIR%\Inf\Hal.inf"
End if
End Sub
Function ReadIni(file, section, item)
ReadIni = ""
file = Trim(file)
item = Trim(item)
Set ini = objFSO.OpenTextFile( file, 1, True)
Do While ini.AtEndOfStream = False
line = ini.ReadLine
line = Trim(line)
If LCase(line) = "[" & LCase(section) & "]" Then
line = ini.ReadLine
line = Trim(line)
Do While Left( line, 1) <> "["
'If InStr( 1, line, item & "=", 1) = 1 Then
equalpos = InStr(1, line, "=", 1 )
If equalpos > 0 Then
leftstring = Left(line, equalpos - 1 )
leftstring = Trim(leftstring)
If LCase(leftstring) = LCase(item) Then
ReadIni = Mid( line, equalpos + 1 )
ReadIni = Trim(ReadIni)
Exit Do
End If
End If
If ini.AtEndOfStream Then Exit Do
line = ini.ReadLine
line = Trim(line)
Loop
Exit Do
End If
Loop
ini.Close
End Function
Sub WriteIni( file, section, item, myvalue )
in_section = False
section_exists = False
item_exists = ( ReadIni( file, section, item ) <> "" )
wrote = False
file = Trim(file)
itemtrimmed = Trim(item)
myvalue = Trim(myvalue)
temp_ini = objFSO.GetParentFolderName(file) & "\" & objFSO.GetTempName
Set read_ini = objFSO.OpenTextFile( file, 1, True, TristateFalse )
Set write_ini = objFSO.CreateTextFile( temp_ini, False)
While read_ini.AtEndOfStream = False
line = read_ini.ReadLine
linetrimmed = Trim(line)
If wrote = False Then
If LCase(line) = "[" & LCase(section) & "]" Then
section_exists = True
in_section = True
ElseIf InStr( line, "[" ) = 1 Then
in_section = False
End If
End If
If in_section Then
If item_exists = False Then
write_ini.WriteLine line
write_ini.WriteLine item & "=" & myvalue
wrote = True
in_section = False
Else
equalpos = InStr(1, line, "=", 1 )
If equalpos > 0 Then
leftstring = Left(line, equalpos - 1 )
leftstring = Trim(leftstring)
If LCase(leftstring) = LCase(item) Then
write_ini.WriteLine itemtrimmed & "=" & myvalue
wrote = True
in_section = False
End If
End If
If Not wrote Then
write_ini.WriteLine line
End If
End If
Else
write_ini.WriteLine line
End If
Wend
If section_exists = False Then ' section doesn't exist
write_ini.WriteLine
write_ini.WriteLine "[" & section & "]"
write_ini.WriteLine itemtrimmed & "=" & myvalue
End If
read_ini.Close
write_ini.Close
If objFSO.FileExists(file) then
objFSO.DeleteFile file, True
End if
objFSO.CopyFile temp_ini, file, true
objFSO.DeleteFile temp_ini, True
End Sub