Add a Driver Online in Audit Mode

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 use an answer file to automate the installation of device drivers when the computer is booted in audit mode.

Adding a Device Driver

The auditSystem configuration pass processes unattended Setup settings while Windows® is running in system context, before a user logs on to the computer in audit mode. The auditSystem configuration pass runs only if the computer is booted in audit mode. To add device drivers during the auditSystem configuration pass, add the Microsoft-Windows-PnpCustomizationsNonWinPE component to your answer file in the auditSystem configuration pass, and specify the path for each device driver. After you run Setup, boot Windows to audit mode. You can run the Sysprep command with the /audit option to configure the computer to start in audit mode the next time that it boots. Or, in the answer file, you can configure the Microsoft-Windows-Deployment\Reseal\Mode setting to audit. For more information about this setting, see the Windows® Unattended Setup Reference.

To add a device driver during the auditSystem configuration pass

  1. Locate the.inf files that you want to install during audit mode for the device driver.

  2. Open Windows System Image Manager (Windows SIM). Click Start, point to Programs, point to Microsoft Windows OPK (or Windows AIK), and then click Windows System Image Manager.

  3. Open your answer file and expand the Components node to display available settings.

  4. Add the Microsoft-Windows-PnpCustomizationsNonWinPE component to your answer file in the auditSystem configuration pass.

  5. Expand the Microsoft-Windows-PnpCustomizationsNonWinPE node in the answer file. Right-click DevicePaths, and then click Insert New PathAndCredentials.

    A new PathAndCredentials list item appears.

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

  7. In the Microsoft-Windows-PnpCustomizationsNonWinPE component, specify the path of the device driver and the credentials that are 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, 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 resemble this example:

    <?xml version="1.0" encoding="utf-8" ?> 
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
       <settings pass="auditSystem">
          <component name="Microsoft-Windows-PnpCustomizationsNonWinPE" 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>\\networkshare\share\drivers</Path> 
                </PathAndCredentials>
             </DriverPaths>
          </component>
       </settings>
    </unattend>
    
  2. Boot in Windows Preinstallation Environment (Windows PE), run Windows Setup, and specify the name of the answer file. For example:

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

    The specified answer file is cached to the system so that when you run audit mode, settings in the answer file are applied.

    Setup finishes.

  3. Run the Sysprep command with the /audit option to configure the computer to start in audit mode the next time that it boots. For example:

    sysprep /audit /reboot
    

    When Windows reboots in audit mode, device drivers that you specified in the answer file are added.

You can use the PNPUtil tool to add, remove, and enumerate drivers on a running operating system. For more information about how to use PNPUtil to add or remove Plug and Play drivers, see Install a Plug and Play Device.

See Also

Concepts

Windows Setup Configuration Passes
Service an Online Image
Understanding Device Drivers and Deployment