This script only apply to Windows XP ( I know it’s going away soon, but people still use it!!), and just yesterday I answered a guy on TechNet who had this exact problem. So even though it’s almost obsolete I thought I put it up anyway!

In cases where you want to run OSD using a USB key, you will have to attach that KEY directly to the SCCM server, or if you are running from a console, attach it to the PC where you are running it from. So an easier solution is to just create a boot media ISO, and then copy the content of the ISO to the USB, making it quiet easy to distribute keys around the world, as the local IT-pros could then create their own key, without having access to SCCM. They just need to copy the files to the USB

Problem is the way SCCM creates the boot media.. For some reason the setup is not the same for CD and USB, even though the files look identical, some thing is changed on the USB to make it work during the boot from WinPE to full OS phase.

Investigating this, it turned up an interesting thing. Once I deployed an image using the USB created with file copy, the windows XP Boot.ini was set to boot from disk1 rather than disk0 whish of cause makes the setup fail..

To work around that problem, I asked our developer Jakob to create a script that would make sure the info in boot.ini always pointed to the correct DISK, by simply copy the correct syntax to boot.ini, if incorrect in the first place.

 

strFile = GetBootIniLocation If strFile = "" Then wscript.echo "Boot.ini not found!! Quitting by returncode 1" WScript.Quit 1 End If strSearchText = "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=""Microsoft Windows"" /noexecute=optin /fastdetect" strIniContent = "[boot loader]" & vbCrLf & _ "timeout=30" & vbCrLf & _ "default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS" & vbCrLf & _ "[operating systems]" & vbCrLf & _ "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=""Microsoft Windows"" /noexecute=optin /fastdetect" Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set oShell = CreateObject("WScript.Shell") '//---------------------------------------------------------------------------- '// Main routines '//---------------------------------------------------------------------------- 'open boot.ini for writing oShell.Run "cmd.exe /c attrib -s -h -r " & strFile,0,true Set objTextFile = objFSO.OpenTextFile _ (strFile, ForReading) strText = objTextFile.ReadAll If Not InStr(strText,strSearchText) > 0 Then objTextFile.Close Set objTextFile = objFSO.OpenTextFile(strFile, ForWriting, True) objTextFile.Write strIniContent End If 'close boot.ini for writing oShell.Run "cmd.exe /c attrib +s +h +r " & strFile,0,true '//---------------------------------------------------------------------------- '// Procedures '//---------------------------------------------------------------------------- Function GetBootIniLocation strComputer = "." Set objFSO = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk where DriveType = 3",,48) For Each objItem in colItems If objFSO.FileExists(objItem.Caption & "\boot.ini") Then GetBootIniLocation = objItem.Caption & "\boot.ini" Exit Function End If Next GetBootIniLocation = "" End Function '//---------------------------------------------------------------------------- '// End Script '//----------------------------------------------------------------------------

Just copy the syntax to a VBS file, and run it a the last step before “Setup Windows and Config.Mgr” in your Deploy XP Task Sequence, and there will be no more HAL.dll error messages!

You can download the script here as well