Maintain Driver Configurations When Capturing a Windows Image

A common deployment scenario is to capture a single Windows® image from a reference computer and to apply it to a group of destination computers with identical hardware configurations.

To save time during installation and to speed up the out-of-box experience for end users, you can instruct Windows Setup that the hardware on the reference computer and the destination computers are identical. By doing this, Windows Setup maintains driver configurations during image capture and deployment.

Background

The Windows® 7 and Windows Server® 2008 R2 in-box driver packages include device drivers that support a wide variety of popular hardware. If your specific hardware requires additional device drivers to boot, you can preinstall additional device drivers on your Windows image. These additional device drivers are often supplied with their device hardware by independent hardware vendors (IHVs). For more information about how to add device drivers, see the topic Add Device Drivers by Using Windows Setup in the Windows® OEM Preinstallation Kit (Windows OPK) User's Guide or Windows® Automated Installation Kit (Windows AIK) User's Guide.

To prepare a Windows image for deployment to multiple computers, you must use the System Preparation tool (Sysprep) tool to generalize the Windows image. Generalizing a Windows image removes the computer-specific information and prepares the device drivers for first boot. This preparation includes the following steps:

Device state for hardware is removed.

Boot-critical driver settings are reset to their default values.

Device log files are purged.

The unattended-Setup setting: Microsoft-Windows-PnpSysPrep\PersistAllDeviceInstalls can save time by preventing Windows Setup from removing and reconfiguring the device state for identical hardware. On first boot, the detected device drivers are already preconfigured, potentially enabling a quicker first-boot experience.

Warning

Avoid using the PersistAllDeviceInstalls setting when the hardware and the hardware configuration on the reference computer are not identical to the destination computers. Even seemingly minor changes to the hardware or hardware configuration can cause severe or easily-overlooked problems. For more information, see the Hardware-configuration changes section of this whitepaper.

It is good practice to not use the PersistAllDeviceInstalls setting on your primary reference image. Instead, for each group of computers with a different hardware configuration, first load your primary reference image onto a new reference computer with the planned hardware configuration. Next, capture a new image of this setup and use the PersistAllDeviceInstalls setting.

Hardware-configuration changes

For the PersistAllDeviceInstalls setting to work properly, the hardware configuration must be identical on the reference computer and the destination computers. Hardware configuration includes the following components:

Hardware make and model.

Firmware. Updates, revisions, and configuration changes can cause some devices to report different device driver-matching criteria or use different resources. For example:

PCI-based devices can embed different subsystem revision numbers into their reported hardware IDs.

BIOS revisions can change the ACPI namespace, causing existing devices to either be reported differently or to be introduced as new devices.

BIOS system configuration changes can result in system devices claiming different memory, I/O, DMA, or IRQ resources.

Physical location. Slot, port, or socket numbers that devices are connected to must not change between hardware configurations. For example:

PCI expansion cards must be plugged into the same slot numbers.

USB devices must be connected or wired to the same port numbers on the same USB host controllers and integrated hubs.

Storage devices must be connected to the same storage controllers and channels.

Hardware-configuration changes that are likely to cause problems

When using the PersistAllDeviceInstalls setting, any hardware change can potentially cause problems. Some changes are more likely to cause problems than others.

Low risk

For these types of hardware changes, you may be able to work around potential driver conflicts and still use the PersistAllDeviceInstalls setting:

Hardware-configuration changes that can cause the system to fail to boot

When the boot-critical hardware is not identical on the reference computer and destination computers, using the PersistAllDeviceInstalls setting can cause severe system problems that can leave the computer in a non-bootable state.

Boot-critical driver packages can belong to any of the following Windows 7 or Windows Server 2008 R2 device setup classes, as identified by the ClassGUID directive in the [Version] section of the .inf files in their driver packages:

Undetectable hardware

When deploying a new computer to an end user, some hardware, such as a removable device or a device with an on/off switch, may not be present or detected during first boot. By default, on first boot, Windows Setup removes the preconfigured device state for undetected hardware.

To deploy hardware that may not be present or detected on first boot, add any applicable device drivers to the reference image, connect or turn on the applicable devices so that Windows can install them, and use the unattended-Setup setting Microsoft-Windows-PnpSysprep/DoNotCleanUpNonPresentDevices when capturing the image.

Warning

Using the DoNotCleanUpNonPresentDevices setting can lead to the unnecessary storage of excess device state and contribute to slower boot times.

Driver revisions and driver ranking

Do not maintain multiple versions or revisions of the same driver package in the same image. Use offline or online servicing tools to update drivers. For more information, see the Updating drivers section of this whitepaper.

Normally, when Windows Setup boots a computer and there are multiple versions of a driver package, Setup determines which driver should be installed by using driver ranking. However, when the PersistAllDeviceInstalls setting is used, the normal driver-ranking processes do not occur and devices that use outdated drivers may remain installed. For more information about driver ranking, see the MSDN topic How Setup Ranks Drivers.

Updating drivers

If you do need to add a device driver to an image where the PersistAllDeviceInstalls setting is used, you can update your device drivers by one of the following methods:

Use offline servicing tools such as Deployment Image Servicing and Management (DISM) tool or an unattended answer file. For more information about adding a driver offline, see the topic Add and Remove Drivers Offline in the Windows OPK or Windows AIK.

Alternatively, use online-servicing methods or tools, such as an unattended answer file or DPInst. For more information about adding a driver online, see the topic Add a Driver Online in Audit Mode in the Windows OPK or Windows AIK.

Working around driver conflicts

To avoid driver conflicts between independent boot-critical driver packages, the IHV should make sure that each device driver uses different service names, registry key values, and binary filenames.

Example of a potential driver conflict

In the following example, a fictitious IHV named Fabrikam produces two types of storage controllers: the StandardController and the ExtremeController. Fabrikam assumes that only one type of storage controller is installed at a time on a given computer.

The driver package defines the StandardController and ExtremeController configurations to use the same driver service name, storctrl. The storctrl driver service uses different service settings that change depending on which hardware (StandardController or ExtremeController) is installed. Because both the StandardController and ExtremeController use the same service, they cannot coexist.

If a StandardController is present on the reference computer and its settings are maintained during image capture, the storctrl driver service is preconfigured. When an ExtremeController is present on the destination computer, Windows may use the preconfigured settings and files intended for StandardController, which can create potentially unexpected results.

The IHV can help resolve the conflict by using one of the following options:

Create separate driver packages with separate .inf files for each configuration, and import only the required driver package into the Windows image during deployment. For example, split storctrl.inf into two separate .inf files: one version for StandardController and one version for ExtremeController, and import only the required driver package into the Windows image.

Alternatively, create another service in the driver package for each configuration. Give each service a different name (example: storctrl and storctrlx) and point to a different binary image file (example: storctrl.sys and storctrlx.sys).