Windows 7 Deployment Part 5

If you have only a few standard models of computer in the organisation then you can maintain specific Windows 7 images for each. But if you have many models you may want to be able to add or update drivers without capturing a new image.

This piece looks at the different ways you can add drivers, and what happens when you do.

You can add or remove drivers in two main ways:

  1. Servicing the image as a file
  2. Running Windows 7 in Audit mode.

You can do either of these at two different places in the deployment workflow:

  1. On a base image, recapturing the image as an updated or customised version of the base before it is deployed anywhere
  2. While deploying an image to a specific production computer.

This gives you four potential methods:

  1. Servicing the image before deployment
  2. Servicing the image during deployment
  3. Running in Audit mode before deployment
  4. Running in Audit mode during deployment.

First, a bit of background about how Windows 7 manages drivers. Windows 7 keeps a database of approved drivers in a special folder called the Driver Store. This folder has Full Control permissions only for System and Trusted Installer. Therefore the interactive sesson cannot write to it and a system process is needed to import drivers into it.

The processes involved in using a driver from the Driver Store are:

  • Windows detects new hardware
  • Windows selects the best match drivers in the Driver Store and sets up the hardware with the drivers.

The default Driver Store in Windows 7 has in the order of 650 sets of drivers.


1. Servicing before deployment

Before deployment the Windows 7 image exists as a file. The file can be opened and manipulated. Deployment Image Servicing and Management (DISM) is the new tool to do this. DISM is supplied as part of the Windows Automated Installation Kit (WAIK), which you set up on any deployment workstation or server. DISM mounts the image file (.wim) as a folder in Windows, giving you the opportunity to add files or edit the registry.

After mounting the image with dism /mount-wim, you add drivers to the driver store with dism /add-driver. You then commit the changes and unmount the image. Obviously you could do something like add a set of Dell drivers to a default image and commit it as a customised image for Dells.

Dism /add-driver reads each driver INF file provided in the command line and does the following:

  1. Imports the driver package into a new folder in the Driver Store AddDrivers2
  2. Indexes the INF file as oem#nnn in the %SystemRoot%inf folder AddDrivers4
  3. For boot critical drivers only:
    • creates the registry keys in the offline registry hive
    • copies files into %SystemRoot%System32 and %SystemRoot%System32Drivers
    • copies files into %ProgramFiles%[Vendor].

Dism /add-driver does not run the DrvInst process to select the driver. This only happens online.

For three devices from one vendor this took 11 minutes. Now these drivers will be loaded on boot or evaluated by Plug and Play on hardware detection the same as if they had been shipped with Windows.


You can also use DISM to:

  • enable or disable Windows features
  • apply Windows updates (but not service packs)
  • add or remove a language pack, and configure international settings

2. Servicing during deployment

You can modify the Windows 7 image after it is copied to the computer but before it boots by performing an Offline Servicing pass in Setup.

To add drivers during the Offline Servicing pass you need to configure the sysprep unattend.xml file.

To configure the file with Windows System Image Manager (WSIM), which is also part of the WAIK:

  1. Open the Distribution Share. WSIMOutofBoxDrivers
  2. Right click the Out-of-Box Drivers folder and select Insert Driver Path to Pass 2 offlineServicing. The required component is added to your unattend.xml file.WSIMAddDriversPathOfflineServicing
  3. The path can be the Distribution Share, or it can be a folder in the image like C:Drivers, or both. If a network share, you can specify credentials.

Note that WSIM is just a GUI for editing the unattend. The Out-of-Box Drivers folder shown in the Distribution Share is a way of adding the correct path.

Here is what happens when you perform Setup with an offlineServicing pass:

  • WinPE, after partitioning the disk and laying down the image file, moves into an offlineServicing pass and calls Deployment Image Servicing and Management (DISM)
  • DISM imports the driver package from the Driver Path you specified into a folder in the Driver Store, in the same way as it does before deployment.

After the offlineServicing pass, Windows boots as normal into the Specialize pass where DrvInst is called to select matching drivers from the Driver Store based on driver ranking.

3. Audit mode before deployment

Another way to add or update drivers before deployment is to perform an Audit pass. The Audit pass is a way of booting Windows without completing the normal Windows Welcome to complete the setup. The difference between servicing an offline image and an Audit pass is that in Audit mode the OS is actually running. DISM before deployment will install drivers and updates, but it will not install user applications or service packs. You can do these things with an Audit pass.

Specifying an Audit pass instead of OOBE during capture of the base image


To add drivers automatically during the Audit pass you need to configure the sysprep unattend.xml file:

  1. Open WSIM.
  2. Right click the Out-of-Box Drivers folder and select Insert Driver Path to Pass 5 auditSystem. The required component is added to your unattend.xml file.WSIMAddDriversPathAuditSystem
  3. As with Offline Servicing, the path can be the Distribution Share, or it can be a folder in the image like C:Drivers, or both.

Here is what happens when you select an auditSystem pass and specify the Driver Path:

  • Windows 7 boots into Audit mode
  • Setup launches PnPUnattend.exe
  • PnpUnattend imports the driver package into a folder in the Driver Store
  • Indexes the INF file as oem#nnn in the %SystemRoot%inf folder
  • Prompts the user for unsigned driversAuditPassUnsignedDriver
  • At the end of the import, DrvInst runs to install drivers for detected hardware.

On a test VM this process took 9 minutes. You then need to run sysprep to generalize the image again before re-capturing it.

Note that in the Audit pass we used a similar component in the unattend as we did for offlineServicing but:

  • In Offline Servicing setup used DISM
  • In Offline Servicing setup does not run DrvInst to set up the hardware with the driver
  • In Audit mode setup used PnpUnattend
  • In Audit mode setup does run DrvInst to set up the hardware with the driver.

You can also use Audit mode to:

  • install software
  • apply service packs
  • check that the image fully works.

4. Audit mode during deployment

You can also perform an Audit pass while deploying the image to its final destination computer, after Windows boots, but before OOBE. Once in Audit mode you can install drivers and software. The computer will remain in audit mode until you run sysprep /oobe /restart.

Obviously during deployment you want this all to be automatic. You can configure this in the unattend.xml:

  • use the PnpCustomizationsNonWinPE component of the auditSystem pass to specify a Driver PathWSIMAddDriversPathAuditSystem
  • use the Deployment component of the auditUser pass to reseal at the end of Audit and reboot into OOBE

Setup will call PnpUnattend.exe to import the drivers in c:drivers into the Driver Store and then use DrvInst.exe to install them.


  1. You can install drivers (and customize the Windows 7 image in other ways) before or during deployment.
  2. You can use Offline Servicing or Audit mode at either time.
  3. Offline Servicing uses DISM. Audit mode uses PnPUnattend.
  4. The process of importing drivers into the Driver Store and selecting a driver to match a Plug and Play hardware device is the same in either case.
  5. Importing drivers takes a significant amount of time. This does not matter before deployment. But during deployment you will want to minimise the number of drivers you import.
  6. Offline Servicing and Audit mode use the same PnPCustomization xml in the unattend.xml file to specify a driver path for the additional drivers.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.