Add Device Drivers to an Offline Windows Image
You can use Package Manager (Pkgmgr.exe) to install one or more device drivers to an offline Windows image. With Pkgmgr, boot-critical device drivers are added to Windows before installation.
When you use Package Manager to install a device driver to an offline image, the device driver is added to the driver store. The driver store is a location on the computer that contains all the drivers for that computer. When Plug and Play runs, detected devices are matched with device drivers in the driver store. The driver store replaces Drivers.cab in Microsoft Windows XP and earlier operating systems.
Boot-critical drivers are reflected on the system. Driver reflection is the process of installing a driver on a computer that might or might not have a device for that driver. Typically, this involves copying the driver files to a destination location and creating the service.
If you need drivers for Windows PE to see the local hard disk drive or a network, the WindowsPE configuration pass must be used to add drivers to the Windows PE driver store and to reflect boot-critical drivers required by Windows PE. For more information, see Add Device Drivers During Windows Setup.
It is important to note that all drivers in the directory and subdirectories that are referenced in the answer file are added to the image. You should manage the answer file and these directories carefully to address concerns about increasing the size of the image with unnecessary driver packages.
To add drivers to an offline Windows image
Locate the device driver .inf files that you intend to install on your Windows image.
Use Windows System Image Manager (Windows SIM) to create an answer file that contains the paths to the device drivers that you intend to install.
Add the Microsoft-Windows-PnpCustomizationsNonWinPE component to your answer file in the offlineServicing pass.
Expand the Microsoft-Windows-PnpCustomizationsNonWinPE node in the answer file. Right-click DevicePaths, and then select Insert New PathAndCredentials.
A new PathAndCredentials list item appears.
For each location that you intend to access, add a separate PathAndCredentials list item.
In the Microsoft-Windows-PnpCustomizationsNonWinPE component, specify the path to the device driver and the credentials used to access the file if the file is on a network share.
Note You can include multiple device driver paths by adding multiple PathAndCredentials list items. If you add multiple list items, you must increment the value of Key for each path. For example, you can add two separate driver paths where the value of Key for the first path equals to 1 and the value of Key for the second path equals to 2.
Save the answer file and exit Windows SIM. The answer file must be similar to the following sample.
<?xml version="1.0" ?> <unattend xmlns="urn:schemas-microsoft-com:asm.v3" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <settings pass="offlineServicing"> <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"> <DriverPaths> <PathAndCredentials wcm:keyValue="1"> <Path>\\networkshare\share\drivers</Path> <Credentials> <Domain>Fabrikam</Domain> <Username>MyUserName</Username> <Password>MyPassword</Password> </Credentials> </PathAndCredentials> </DriverPaths> </component> </settings> </unattend>
Mount the Windows image that you intend to install the drivers to by using ImageX. For example:
imagex /mountrw C:\windows_distribution\sources\install.wim 1 C:\wim_mount
Enable logging of specific device driver injection actions in a separate log file. Edit the following registry key on the computer on which you are running Package Manager:
Path: HKLM\Software\Microsoft\Windows\CurrentVersion\Device Installer
This will create a Drivers.log file during the driver package injection. This log file will log all actions of the driver injection process.
Use Package Manager to apply the unattended installation answer file to the mounted Windows image. Specify a location for the log file to create. For example,
pkgmgr /o:"C:\wim_mount\;C:\wim_mount\Windows" /n:"C:\unattend.xml" /l:"C:\pkgmgrlogs\logfile.txt"
The .inf files referenced in the path in the answer file are added to the Windows image. A log file is created in the directory C:\Pkgmgrlogs\. Driver log files are created in the directory that PkgMgr runs from. You can open the Drivers.log file and review the Package Manager driver injection actions.
Review the contents of the %WINDIR%\Inf\ directory in the mounted Windows image to ensure that the .inf files were installed. Drivers added to the Windows image are named oem*.inf. This is to ensure unique naming for new drivers added to the computer. For example, the files MyDriver1.inf and MyDriver2.inf are renamed oem0.inf and oem1.inf.
Unmount the .wim file and commit the changes. For example,
imagex /unmount /commit C:\wim_mount
The Windows image is ready to be deployed.