Partager via


Add Device Drivers by Using Windows Setup

Applies To: Windows 7, Windows Server 2008 R2

Note

This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

You can add a driver to Windows® using Windows Setup and an unattended answer file. The answer file specifies the path to driver files. This is done by adding the Microsoft-Windows-PnpCustomizationWinPE or Microsoft-Windows-PnpCustomizationNonWinPE components to your answer file and then specifying the configuration passes in which you intend to install the drivers.

The following table describes the different configuration passes and how they are used to add device drivers during Windows Setup.

Configuration Pass Description Adding device drivers

windowsPE

This configuration pass is used to configure settings that are specific to Windows Preinstallation Environment (Windows PE).If you need drivers for Windows PE to see the local hard disk drive or a network, this configuration pass must be used to add the necessary drivers to the Windows PE driver store.

The windowsPE configuration pass also configures settings that apply to installation. This means that drivers in the Windows PE driver store are also reflected into the offline Windows image or copied to the Windows image driver store during offline servicing.

For more information, see windowsPE Configuration Pass.

Add the Microsoft-Windows-PnpCustomizationsWinPE component to your answer file in the windowsPE configuration pass, and then add device driver paths to the Microsoft-Windows-PnpCustomizationsWinPE component.

Boot to Windows PE, run Windows Setup and specify the name of the answer file.

This method initiates Windows PE and processes Windows PE settings from the answer file. First, Windows PE drivers are staged in the driver store in RAM, and boot-critical drivers that are required for Windows PE to access the local disk and network are reflected into Windows PE. Other Windows PE customizations that are specified in the answer file are also processed.

Second, during Windows Setup, the Windows image is applied and boot-critical drivers are reflected on the Windows image before that image is installed. Other drivers that were added to the Windows PE driver store are staged to the Windows image driver store. When the offlineServicing pass is processed, any drivers specified in the driver path are also added to the Windows image driver store.

offlineServicing

This configuration pass runs during Windows Setup to apply unattended Setup settings to an offline Windows image.

Add the Microsoft-Windows-PnpCustomizationNonWinPE component to your answer file in the offlineServicing configuration pass, and then add device driver paths to the Microsoft-Windows-PnpCustomizationNonWinPE component.

Run Windows Setup and specify the name of the answer file.

This method reflects boot-critical drivers to a Windows image before that image is installed, and it processes out-of-box device drivers during Windows Setup, adding the drivers to the Windows image driver store.

Adding a Device Driver During WindowsPE

To add device drivers during the windowsPE configuration pass, create an answer file and specify the paths to device drivers in the Microsoft-Windows-PnpCustomizationsWinPE component before you run Windows Setup.

To add a device driver during WindowsPE

  1. 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.

  2. Add the Microsoft-Windows-PnpCustomizationsWinPE component to your answer file in the windowsPE configuration pass.

  3. Expand the Microsoft-Windows-PnpCustomizationsWinPE node in the answer file. Right-click DevicePaths, and select Insert New PathAndCredentials****.

    A new PathAndCredentials list item appears.

  4. For each location that you access, add a separate PathAndCredentials list item.

  5. In the Microsoft-Windows-PnpCustomizationsWinPE 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, if you add two separate driver paths, then the first path uses the Key value of 1, and the second path uses the Key value of 2.

  1. Save the answer file and close Windows SIM. The answer file must be similar to the following example:

    <?xml version="1.0" encoding="utf-8" ?> 
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
       <settings pass="windowsPE">
          <component name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
             <DriverPaths>
                <PathAndCredentials wcm:keyValue="1" wcm:action="add">
                   <Credentials>
                      <Domain>Fabrikam</Domain> 
                      <Password>MyPassword</Password> 
                      <Username>MyUserName</Username> 
                   </Credentials>
                   <Path>\\server\share\drivers</Path> 
                </PathAndCredentials>
             </DriverPaths>
          </component>
       </settings>
    </unattend>
    
  2. Boot to Windows PE.

  3. At a command prompt, run Windows Setup and specify the name of the answer file. For example,

    setup.exe /unattend:C:\unattend.xml
    

    The device drivers in the path \\networkshare\share\drivers are added to the system during Windows Setup.

See Also

Concepts

Add and Remove Drivers Offline
Add a Driver Online in Audit Mode
Understanding Device Drivers and Deployment