Windows 7 – Add device drivers to install.wim

Add Device Drivers to an Offline Windows Image

The following process details how to add additional drivers to a Windows 7 system image. This will all you to include or bundle drivers into your installation media, allowing the drivers to be automatically installed during the installation process.

In this example we will be adding the drivers to the ‘install.wim’ file which came from a standard Windows 7 installation DVD.

STEP 1: Copy the install.wim and catalouge file

  1. Copy the install.wim  and associated catalogue file (e.g. install_Windows 7 ENTERPRISE.clg) to a temporary working location.
  2. For example, C:\TEMP
  3. MSWIN7-AddDrivers6

STEP 2: Download and install WAIK

  1. Download and install the Windows Automated Installation Kit (WAIK):
  2. MSWIN7-AddDrivers1

STEP 3: Extract drivers to their INF files

  1. Download the drivers from the manufacturer. In this example we’ll be including the Intel graphic drivers for the Dell OptiPlex 990 desktop.
  2. Using your preferred package extract program, extract the file so you are left with the core drivers (INF files etc).
  3. MSWIN7-AddDrivers3
  4. Place all the driver files into a temporary folder, e.g. C:\Drivers
  5. MSWIN7-AddDrivers2

STEP 4: Create a Windows SIM Answer file

The Windows System Image Manager (Windows SIM) application is used to create an answer file. The answer file contains the paths to the device drivers that you intend to install.

  1. Open the Windows System Image Manager (Windows SIM) application
  2. MSWIN7-AddDrivers4
  3. Select the ‘File’ then ‘New’ menu
  4. MSWIN7-AddDrivers5
  5. When prompted, select ‘Yes’
  6. MSWIN7-AddDrivers7
  7. Open the catalogue file (install_Windows 7 ENTERPRISE.clg
  8. MSWIN7-AddDrivers8
  9. Under ‘Windows Image’ expand ‘Components’
  10. Right click on ‘Microsoft-WindowsPnpCustomizationsNonWinPE’ and select ‘Add setting to Pass 2 offlineServicing’
  11. MSWIN7-AddDrivers9
  12. Under ‘Answer File’ expand ‘Microsoft-Windows-PnpCustomizationsNonWinPE’
  13. Right click on ‘DriverPaths’ and select ‘Insert New PathAndCredentials’
  14. MSWIN7-AddDrivers10
  15. Under ‘Key’ enter ‘1’
  16. Under ‘Path’ enter the path to your driver files (e.g. C:\Drivers)
  17. MSWIN7-AddDrivers11
  18. Save the file to your temporary working location (e.g. C:\TEMP)
  19. MSWIN7-AddDrivers12
  20. Close the Windows System Image Manager application.

STEP 5: Enable detailed logging (OPTIONAL)

  1. To enable logging of specific device driver injections by creating the following registry key on your computer: (This log file will log all actions of the driver injection process)
  2. Path: HKLM\Software\Microsoft\Windows\CurrentVersion\Device Installer
    Key: DebugPkgMgr
    Type: REG_DWORD
    Value: 0x01
  3. MSWIN7-AddDrivers14

STEP 6: Mount the image and import the drivers

  1. Create a folder for mounting the image, e.g. C:\TEMP\wim_mount
  2. Open the ‘Deployment Tools Command Prompt’ application ‘as Administrator’
  3. MSWIN7-AddDrivers13
  4. Mount the Windows image by running the following command: (you may need to modify depending on the folder paths you have used)
  5. imagex /mountrw C:\TEMP\install.wim 1 C:\TEMP\wim_mount
  6. MSWIN7-AddDrivers15
  7. Apply the driver answer file to the mounted Windows 7 image by running for following command: (you may need to modify depending on the folder paths you have used)
  8. pkgmgr /o:"C:\TEMP\wim_mount\;C:\TEMP\wim_mount\Windows" /n:"C:\TEMP\Drivers\Answer.xml" /l:"C:TEMPlogfile.txt"
  9. MSWIN7-AddDrivers16
  10. The driver .inf files referenced in the path in the answer file will be added to the Windows 7 image.
  11. A log file is created at  C:\TEMP\Logfile.txt
  12. Unmount the .wim file and commit the changes by running the following command: (you may need to modify depending on the folder paths you have used)
    imagex /unmount /commit C:\TEMP\wim_mount
  13. MSWIN7-AddDrivers17

The Windows 7 image is ready to be deployed, complete with additional drivers. You will be able to use the file on your Windows 7 USB install media or DVD media etc.

For more information about using Package Manager, see Package Manager Command-Line Options.