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:
- Servicing the image as a file
- Running Windows 7 in Audit mode.
You can do either of these at two different places in the deployment workflow:
- On a base image, recapturing the image as an updated or customised version of the base before it is deployed anywhere
- While deploying an image to a specific production computer.
This gives you four potential methods:
- Servicing the image before deployment
- Servicing the image during deployment
- Running in Audit mode before deployment
- 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:
- Imports the driver package into a new folder in the Driver Store
- Indexes the INF file as oem#nnn in the %SystemRoot%inf folder
- 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:
- Open the Distribution Share.
- 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.
- 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:
- Open WSIM.
- 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.
- 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 drivers
- 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 Path
- 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.
- You can install drivers (and customize the Windows 7 image in other ways) before or during deployment.
- You can use Offline Servicing or Audit mode at either time.
- Offline Servicing uses DISM. Audit mode uses PnPUnattend.
- 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.
- 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.
- Offline Servicing and Audit mode use the same PnPCustomization xml in the unattend.xml file to specify a driver path for the additional drivers.