Article ID: 2686316 - View products that this article applies to.
When adding a driver into installation media, do not mix versions. Use the same version of each driver throughout the media.
There are several different methods for including out-of-box drivers into Winpe (boot.wim) and the target installing operating system (install.wim). If the driver versions do not match, the first driver loaded into memory will be used regardless of PNP ranking rules. Other versions may be marked as ‘Bad’ drivers which will prevent these drivers from being selected by PNP at a later time. Thisincludes any driver loaded into memory during the boot to WinPE (Winpe phase) of installation. Examples could include injecting drivers into boot.wim via DISM.exe or loading a driver using Drvload.exe to manually load the driver.
Purpose of this document:
This document provides guidance on including drivers into WinPE and the operating system to be installed so that the driver is available in the WinPE portion of installation and also ends up in the completed operating system installation.
Consider the following scenario: you are creating a custom Windows Pre-installation Environment (WinPE) image for the purposes of installing Windows operating systems that needs an out-of-box storage controller driver prior to running Setup.exe in order to manipulate the disks. Additionally, you want to provide “up-to-date” drivers for inclusion via the \$WinPEDriver$ folder feature of Setup, to include later versions of the same driver.
The $WinPEDriver$ feature is intended as a method to provide drivers at installation time. However, it is a feature of Setup.exe, and as such is not invoked until after Setup.exe launches. Drivers for present devices which are injected manually into the WinPE boot.wim driverstore using DISM are loaded into memory at boot time. These two mechanisms are separate, and there are some caveats to using them together.
WinPE does not have a built in mechanism to unload drivers which have been loaded into memory, so any drivers for devices which have already been loaded will not be reloaded once setup.exe starts, as there are already drivers for the device loaded. This error will cause Setup to mark the driver in the $WinPEDriver$ folder as a bad driver, even if it is newer than the driver version injected into WinPE and would otherwise outrank it. Setup has no explicit knowledge of drivers that have been loaded into the boot.wim.
This behavior is by design; however this article will identify a method of accommodating this scenario so these drivers can still be included in the deployable operating system.
Given the above scenario, putting WinPE on a bootable USB Flash Device (UFD) hard drive or thumb stick would be most preferable.
In this document we are going to be highlighting methods for injecting drivers and launching windows. The following chart briefly depicts methods and results of including drivers.
Collapse this tableExpand this table
Please keep in mind that there are some drivers that can be included and/or loaded that may not be functional during WinPE portion of installation. This would include, but is not limited too; video drivers, wireless adapter drivers, and audio drivers. The behavior described in this document is not specific to BootCritical drivers (drivers need during bootu-p such as controller drivers for access to hard drive) and is in affect for all drivers loaded during installation/deployment.
Walk through of loading drivers from StartNet.cmd
This is but one method for including the same driver into Windows Preinstallation Environment (WinPE) as well as making it available to the installing operating system; other methods are possible using the information further in this document.
Methods for including drivers into WinPE include:
Launching Windows installation
There are several methods for launching the installation of the operating system from WinPE, including:
Methods for adding drivers to Windows
Next, following the progression from installation to inclusion of out-of-box drivers, there are a few methods available to include out-of-box drivers in Windows:
NOTE: If a driver is loaded during WinPE pass (initial boot) there is no native mechanism in place to remove that driver until the operating
There are multiple methods for each step of the process of adding drivers to Windows. The methods provide for a very extensible and malleable deployment scenario. You will want to determine which method below works best for the given situation.
Detailed instructions for including out of box drivers in WinPE
• Technicians computer – computer used to build/manipulate installation media
• OPK / AIK installed
• USB/UFD or DVD
$WinpeDrivers$ is an additional folder structure that Setup.exe looks for and if found, is parsed to pull in additional drivers. Setup will recursively parse files and folders under this \$WinpeDriver$ folder looking for *.INF files and attempts to install these discovered drivers into the driverstore.
Folder structure can look something like this on the root of the USB device:
└Wireless.CAT (Needed by operating system)
NOTE: if you look in the \Windows\Panther\Setupact.log you can see reference to this folder:
PnPIBS: Checking for pre-configured driver paths ...
PnPIBS: Checking for pre-configured driver directory C:\$WinPEDriver$.
PnPIBS: Checking for pre-configured driver directory D:\$WinPEDriver$.
PnPIBS: Checking for pre-configured driver directory E:\$WinPEDriver$.
PnPIBS: Checking for pre-configured driver directory X:\$WinPEDriver$.
Using Unattended answer file (unattend.xml/autounattend.xml):
Windows has the option to automatically look for an unattended answer file on the root of mounted drives if the files is named autounattend.xml. Windows will also pick up an unattended answer file if specifically launched with Setup.exe using switches. This answer file can provide information to the installing operating system for such things as drive configuration, product key, computer name, and path to driver store, OEM company information, as well as many other things. Documentation on how to add a driver to the unattend.xml can be found at the end of this document in the References and Links section.
Below is an example snippet of an AutoUnattend.xml with Drvstore from an AIK Unattend.chm. The XML output specifies the UNC path to additional locations for device drivers and the credentials used to access the network paths.
<!-- First PathAndCredentials list item -->
<PathAndCredentials wcm:action="add" wcm:keyValue="1">
<!-- Second PathAndCredentials list item -->
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
Drvload is a tool in WinPE used to add in drivers once you are booted up to the built in WinPE Command Prompt. When using Drvload, the drivers will need to be identified and placed somewhere. WinPE's startnet.cmd can be used to script Drvload, as well as either of the following actions whiled booting or booted to WinPE:
As a means of scripting/automating the installation, the USB device needs to be identified since this is the location of the additional drivers. This example uses a script in WinPE that is autorun on startup to detect the USB drive. This script launches another script to install drivers using Drvload.exe in the WinPE stage of setup. The script is outside of the WIM file so it can easily be modified.
Methods for identifying installation media using WinPE Startnet.cmd (first file launched in default WinPE):
Using this method, the driver that is made available for the operating system is first picked up and used by WinPE.
Windows Recovery Environment (WinRE):
WinRE is typically going to be static on the hard drive, either auto-installed during installation or created/customized by OEMs for recovery scenarios. If the WinRE is used to recover the machine to factory defaults, then there really is no method to dynamically update drivers to the latest version. You will have to create an image using injected drivers into all relevant WIM files such as the WinRE.wim/Boot.wim as well as the image to be applied for the operating system. Ensure that these drivers are all the same versions.
If your requirement is to create a WinPE environment that loads out of box drivers prior to running setup.exe, follow the guidelines described in this document in order to end up with the driver you want in the resulting installed operating system. Writing scripts which leverage Drvload.exe launched by startnet.cmd to load specific drivers located in the \$WinPeDriver$ folder on a USB flash drive is the most flexible method available. This method allows you to load a driver during the WinPE phase that carries over into the installed operating system. In addition, it allows for maintaining of a central repository for drivers that will allow for flexibility to update these drivers (so as to maintain the latest drivers in your driver store).
References and Links:
Add Device Drivers during Windows Setup
What Is Deployment Image Servicing and Management?
Deployment Image Servicing and Management Command-Line Options
Drvload Command-Line Options
Understanding Device Drivers and Deployment
Driver Paths in Unattend.xml
Add a Package to a Windows PE Image
What Is Windows RE?
How Windows RE Works
Walkthrough: Create a Bootable Windows PE RAM Disk on CD-ROM
Walkthrough: Create a Bootable Windows PE RAM Disk on a USB Flash Disk
How Configuration Passes Work
Windows Automated Installation Kit (AIK) for Win7/2008r2
Windows OEM Preinstallation Kit (OPK)
(Note: You will need an account to be able to download files from the OEM site.)
(http://go.microsoft.com/fwlink/?LinkId=151500)for other considerations.
Article ID: 2686316 - Last Review: April 4, 2012 - Revision: 2.0