Injecting Drivers into Windows Install Media

Although this article may be a little late, this is a useful guide to keep on hand if servicing computers with Windows 7. I’ll update this article on details for Windows 8-10 once I have some free time to mess around with the Windows 10 installation media.

The following is separated into two parts, the Boot image and the Installation image. The boot image refers to the system that loads before installing windows. It provides the setup wizard and a few other hidden features for diagnostics and recovery. The installation image simply refers to the Windows system image that is installed on the destination computer. An OEM installation disc of Windows 7 contains only one boot image, but it can contain many different installation images all jammed into the install.wim file, each with their own index number.

Boot Image

This is only needed when getting a driver error during windows setup. An example of this is when using a USB to install Windows 7 on a PC with only USB 3.0 ports; The OEM Windows 7 installation disc does not have any USB 3.0 drivers so these will need to be added manually.

  1. Create a working directory such as C:\winstall

  2. From the windows installation CD or ISO, copy the sources\boot.wim file to the working directory C:\winstall\boot.wim

  3. Create a mount folder in the working directory such as C:\winstall\mount

  4. Create a driver storage folder in the working directory such as C:\winstall\drivers

  5. Move all driver .inf files to the drivers folder

  6. Open an elevated command prompt

  7. In the command prompt, go to the working directory created in step 1:

    cd C:\winstall
    
  8. Make note of the index number of the boot image:

    dism /get-imageinfo /imagefile:boot.wim
    
  9. Run the following commands with the proper index number from the previous step to mount, add drivers, and unmount the image:

    dism /mount-wim /wimfile:boot.wim /index:2 /mountdir:mount
    dism /image:mount /add-driver /driver:drivers /recurse
    dism /unmount-wim /mountdir:mount /commit
    
  10. Move the C:\winstall\boot.wim file back to the sources folder of the installation USB sources\boot.wim. If it’s a CD/ISO you will need to burn a new CD or create a new ISO with the updated file.

Installation Image

This is to add drivers to the final windows installation. Doing this will help avoid having to find and install drivers after doing a fresh installation (such as network and display drivers).

  1. Create a working directory such as C:\winstall

  2. From the windows installation CD/ISO or USB, copy the sources\install.wim file to the working directory C:\winstall\install.wim

  3. Create a mount folder in the working directory such as C:\winstall\mount

  4. Create a driver storage folder in the working directory such as C:\winstall\drivers

  5. Move all driver .inf files to the drivers folder

  6. Open an elevated command prompt

  7. In the command prompt, go to the working directory:

    cd C:\winstall
    
  8. Make note of the index number of the installation image that you want to modify:

    dism /get-imageinfo /imagefile:install.wim
    
  9. Run the following commands with the proper index number to mount, add drivers, and unmount the image:

    dism /mount-image /imagefile:install.wim /index:1 /mountdir:mount
    dism /image:mount /add-driver /driver:drivers /recurse
    dism /unmount-image /mountdir:mount /commit
    
  10. Move the C:\winstall\install.wim file back to the sources folder of the installation USB sources\install.wim. If it’s a CD/ISO you will need to burn a new CD or create a new ISO with the updated file.

Avatar
Jack Wozny
IS Security Operations Engineer

I’m a computer systems engineer! I love working with technology, tinkering with and optimizing new systems.

comments powered by Disqus