Drivers From CD (Simple Method)
Updated: 11/08/05 (The old AutoIt Method is available here.)
This is not my method. Major thanks to idle.newbie and hp38guser, as most of this is their work.
Thanks also go out to Pyron for making SetupCopyOEMInf.exe and WatchDriverSigningPolicy.exe, which are used in this method.
The info from this outline is from this post, and, more specifically: here, here, and here.
This is a method of automatically installing drivers (which are located on your CD), for devices that are plugged into the computer that WindowsXP is being installed on. This new way uses a Batch file. Why another way, you ask? The reason is simple:
This method does not need the use of a FAKE setup.exe, nor does it need extra lines in TXTSETUP.SIF (like other methods do). It's very simple and straightforward.
It's as easy as 1, 2, 3:
1. Download the attached zip file, and unzip its contents to $OEM$\.
(There are 6 files in the zip: 7za.exe, Drivers.cmd, nircmd.exe, Process.exe, SetupCopyOEMInf.exe, WatchDriverSigningPolicy.exe)
(These files will run from the CD, and are never copied to the Hard Drive.)
2. Open up winnt.sif (located in i386), and add two lines under [GuiUnattended], as shown below:
If you WANT the cmd window (batch file) to show, use THIS code:
Winnt.sif
CODE
[GuiUnattended]
DetachedProgram=".\system32\cmd.exe"
Arguments="/Q /C FOR /F %I IN (%SystemRoot%\SYSTEM32\$WINNT$.INF) DO (FOR %J IN (%I$OEM$) DO (IF EXIST %J (start /min /D%J Drivers.cmd)))"
DetachedProgram=".\system32\cmd.exe"
Arguments="/Q /C FOR /F %I IN (%SystemRoot%\SYSTEM32\$WINNT$.INF) DO (FOR %J IN (%I$OEM$) DO (IF EXIST %J (start /min /D%J Drivers.cmd)))"
If you DO NOT want the cmd window (batch file) to show AT ALL, use THIS code:
Winnt.sif
CODE
[GuiUnattended]
DetachedProgram=".\system32\cmd.exe"
Arguments="/Q /C FOR /F %I IN (%SystemRoot%\SYSTEM32\$WINNT$.INF) DO (FOR %J IN (%I$OEM$) DO (IF EXIST %J (start /min /D%J NirCmd.exe exec hide Drivers.cmd)))"
DetachedProgram=".\system32\cmd.exe"
Arguments="/Q /C FOR /F %I IN (%SystemRoot%\SYSTEM32\$WINNT$.INF) DO (FOR %J IN (%I$OEM$) DO (IF EXIST %J (start /min /D%J NirCmd.exe exec hide Drivers.cmd)))"
(If you want more info on this coding, see this post, and this post.)
3. Place any drivers you want to have auto-detected into $OEM$\Drivers (you must create the directory).
Notes:
-= This method does not require any files to be copied over the the HDD - it runs totally from the CD.
-= Plug'n Play devices are detected during Windows Setup after the DetachedProgram stage (t-39), which is when this script is run, so Windows Setup will detect and install all applicable drivers.
-= If you are using a Normal XP CD (SingleBoot), don't worry about spaces in the folder names. (For example: "Wireless Card Drivers" will work just as well (even though there are spaces in the name) as "Wireless_Card_Drivers").
-= If you are using a MultiBoot Disc, you can also use spaces anywhere - EXCEPT in SourcePath. Example (red=won't work; green=will work):
QUOTE ( Example: Red=Won't Work; Green=Will Work )
CD:\XP Pro\$OEM$\Drivers\nVidia ForceWare 77.72\ <-- WON'T work. (Replace space in "XP Pro" with underscore or dash.)
CD:\XP-Pro_A\$OEM$\Drivers\nVidia ForceWare 77.72\ <-- WILL work.
CD:\XP-Pro_A\$OEM$\Drivers\nVidia ForceWare 77.72\ <-- WILL work.
-= Also, please note this method will not work for MassStorage Device drivers.
-= It should be noted that WatchDriverSigningPolicy works most of the time, but occassionally the dialog for the installation of unsigned drivers pops up nevertheless. Pyron said he has no idea why, but Setup seems to ignore the registry values sometimes.
If you are still confused, here is a sample XPCD layout (colors correspond to the steps above):
QUOTE ( Sample CD Layout )
├───$OEM$
│.......├───Drivers
│................├───C-Media CMI8738 6.39
│................├───Medion SAA7134 2.3.1.0
│................├───Monitor
│........................├───AL712
│................├───nVidia ForceWare 77.72
│................├───Samsung ML-1210
│................├───Laptop
│........................├───Touchpad
│........................├───Infared 12.6
│.......├───7za.exe
│.......├───Drivers.cmd
│.......├───nircmd.exe
│.......├───Process.exe
│.......├───SetupCopyOEMInf.exe
│.......├───WatchDriverSigningPolicy.exe
├───I386
│.......├───winnt.sif
│.......├───Drivers
│................├───C-Media CMI8738 6.39
│................├───Medion SAA7134 2.3.1.0
│................├───Monitor
│........................├───AL712
│................├───nVidia ForceWare 77.72
│................├───Samsung ML-1210
│................├───Laptop
│........................├───Touchpad
│........................├───Infared 12.6
│.......├───7za.exe
│.......├───Drivers.cmd
│.......├───nircmd.exe
│.......├───Process.exe
│.......├───SetupCopyOEMInf.exe
│.......├───WatchDriverSigningPolicy.exe
├───I386
│.......├───winnt.sif
More Info
What's In It?
The attached zip contains the following files (ALL should be placed in your $OEM$ directory):
7za.exe
7za.exe is the command line version of 7-zip v4.23 (link).
This file is used only if you add a "Drivers.7z" file. (It will extract the "Drivers.7z" to the Hard Drive).
If you are not using compressed drivers, it is safe to delete this file.
Drivers.cmd
CODE
CLS
@ECHO OFF
TITLE Drivers-from-CD Installation
color 1F
:: Set Current Drive as CD
CD /D "%~dp0"
:: Set Drivers Location Folder
SET DRV=Drivers
:: Ticker script
ECHO.exec hide %CD%\Process.exe -r setup.exe >%SystemDrive%\Ticker.ncl
ECHO.wait 10000 >>%SystemDrive%\Ticker.ncl
ECHO.exec hide %CD%\Process.exe -p SetupCopyOEMInf.exe high >>%SystemDrive%\Ticker.ncl
ECHO.exec hide %CD%\Process.exe -s setup.exe >>%SystemDrive%\Ticker.ncl
ECHO.wait 50000 >>%SystemDrive%\Ticker.ncl
ECHO.script %SystemDrive%\Ticker.ncl >>%SystemDrive%\Ticker.ncl
:: Pre-Install (Suspend Setup, and Set Setup to Low Priority)
.\Process.exe -s setup.exe
.\Process.exe -p setup.exe low
:: Allow for Unsigned Drivers
START .\WatchDriverSigningPolicy.exe
:: If Compressed Drivers Exist, Unzip Them & Change Drivers Location Folder to Hard Drive
IF EXIST Drivers.7z (
SET DRV=%SystemDrive%\Drivers
.\7za.exe x -y -aoa -o"%SystemDrive%\Drivers" ".\Drivers.7z"
)
:: Run NirCmd Ticker Script (code above)
START .\NirCmd.exe script %SystemDrive%\Ticker.ncl
:: Install Drivers
.\SetupCopyOEMInf.exe "%DRV%"
:: Post-Install (Close NirCmd, Setup Priority back to Normal, Resume Setup)
.\Process.exe -k NirCmd.exe
.\Process.exe -p setup.exe normal
.\Process.exe -r setup.exe
:: Delete Ticker File
DEL %SystemDrive%\Ticker.ncl
EXIT
@ECHO OFF
TITLE Drivers-from-CD Installation
color 1F
:: Set Current Drive as CD
CD /D "%~dp0"
:: Set Drivers Location Folder
SET DRV=Drivers
:: Ticker script
ECHO.exec hide %CD%\Process.exe -r setup.exe >%SystemDrive%\Ticker.ncl
ECHO.wait 10000 >>%SystemDrive%\Ticker.ncl
ECHO.exec hide %CD%\Process.exe -p SetupCopyOEMInf.exe high >>%SystemDrive%\Ticker.ncl
ECHO.exec hide %CD%\Process.exe -s setup.exe >>%SystemDrive%\Ticker.ncl
ECHO.wait 50000 >>%SystemDrive%\Ticker.ncl
ECHO.script %SystemDrive%\Ticker.ncl >>%SystemDrive%\Ticker.ncl
:: Pre-Install (Suspend Setup, and Set Setup to Low Priority)
.\Process.exe -s setup.exe
.\Process.exe -p setup.exe low
:: Allow for Unsigned Drivers
START .\WatchDriverSigningPolicy.exe
:: If Compressed Drivers Exist, Unzip Them & Change Drivers Location Folder to Hard Drive
IF EXIST Drivers.7z (
SET DRV=%SystemDrive%\Drivers
.\7za.exe x -y -aoa -o"%SystemDrive%\Drivers" ".\Drivers.7z"
)
:: Run NirCmd Ticker Script (code above)
START .\NirCmd.exe script %SystemDrive%\Ticker.ncl
:: Install Drivers
.\SetupCopyOEMInf.exe "%DRV%"
:: Post-Install (Close NirCmd, Setup Priority back to Normal, Resume Setup)
.\Process.exe -k NirCmd.exe
.\Process.exe -p setup.exe normal
.\Process.exe -r setup.exe
:: Delete Ticker File
DEL %SystemDrive%\Ticker.ncl
EXIT
NirCmd v1.80
Created by NirSoft (link)
Used to run Ticker script.
Process.exe v2.03
Created by Beyond Logic (link)
Used to pause setup, set process priorities, and kill processes while drivers install.
SetupCopyOEMInf.exe
Created by Pyron (link)
It scans a dir recursively and calls SetupCopyOEMInf for every .inf it finds (which copies a specified .inf file into the %windir%\Inf directory).
WatchDriverSigningPolicy.exe
Created by Pyron (link)
Basically, this makes it so that when Windows finds non-signed drivers (non-WHQL), it doesn't care.
The source for WatchDriverSigningPolicy is here. Although the attachment doesn't seem to be working, the basic outline of the code is in the post.
How Does It Work? (A Much Simplified Guide)
When Windows Setup reads the GuiUnattended section of winnt.sif, it will load up our Drivers.cmd code.
The Drivers.cmd file will first pause Windows Setup (using Process.exe).
Next, it will activate WatchDriverSigningPolicy.exe so that we can install unsigned drivers.
The batch script will then determine if compressed drivers exist. If so, it will extract them.
Then it will run SetupCopyOEMInf.exe to scan every subdirectory in $OEM$\Drivers (or %systemdrive%\Drivers if compressed drivers exist) and add copy all the .inf files so that Windows will recognize and install drivers for every PnP device (that you included drivers for).
Finally, we resume Windows Setup (again, using Process.exe).
What About Compressed Drivers?
If you use compressed (.7z) drivers, make sure to ADD your compressed "Drivers.7z" to the $OEM$ folder. The batch will automatically detect the compressed drivers (make sure it is named "Drivers.7z"), unzip it to the Hard Drive (using the included "7za.exe"), and then scan the Hard Drive (instead of the CD) for .inf files.
Updates:
11/08/05: Major updates:
- Solved the problem of setup continuing before all the .inf files are scanned and integrated.
- New Method - (Batch file instead of AutoIt) - Windows Setup will now pause (based on this post and also this post and this post).
- Added Process.exe v2.03, and NirCmd v1.80 to the zip - These are the programs we use to pause Windows Setup.
- This method now works with compressed drivers - just add your "Drivers.7z" to the $OEM$ folder. The batch takes care of the rest.

08/01/05: Re-uploaded the zip file. The only updated file in the zip is the Drivers.au3 - it's a smaller file, with less coding (i.e., no extra crap, as per hp38guser's request (here). It has been tested, and is working.
Attachment Updated: 11/08/05
MD5 Hash: E6FCD3B433BA04D0F0CC96CB7613DA0A
Download from Mirror 1
Download from Mirror 2 (please try above link first...)
