Inject Drivers to Windows 10 Install Media

So Windows 10 is here with its second build (9860) in its “Technical Preview”. Since I am an OSD guy, I like to make sure when a system is built all the drivers are there (even for my test machines and ad-hoc builds to “see if it works”). Usually this just entails adding some drivers and–for the most part–plug and play is nice enough to install everything for me. If you’re without MDT and/or SCCM or just like to have a USB installer ready for anything, you don’t have the luxury of a driver package and just want all the drivers to automatically be there when Windows installs.

This process is very common and really, this applies to Windows Vista (and up) but as I went to inject drivers to Windows 10 media from my Windows 8.1 machine I met an old-friend-of-an-error and figured this was worth sharing.

Get the Drivers

First thing’s first. Get the Drivers! For Windows 10, Microsoft has done a great job of letting Windows 7/8.1 drivers install (or attempt to) and maintain a large percentage of support. So, download all the drivers and put them into one directory. Make sure that any downloaded installers are extracted first to where you can see the inf, cat, and sys files. I know Dell and HP both have self extracting executable for most drivers they offer out.

If you’re like me, you’ll have a huge hierarchy of Manufacturer> Model showcasing all the different models that you want to test on and support.



Create Your Media

Connect a USB Drive (USB 3.0 is better :)). We’ll need to format the disk…This will remove all of the files so make sure to backup anything.

  1. Open an Administrative Command Prompt
  2. DiskPart <enter>
  3. List Disk <enter>
  4. Locate which disk is the usb drive. Easiest way is to tell by size.
  5. select disk # <enter>  (# is the disk number from previous step)
  6. clean <enter>
  7. create partition primary <enter>
  8. select partition 1 <enter>
  9. format fs=fat32 quick <enter>
  10. active <enter>
  11. assign <enter>
  12. exit <enter>

Now you have a clean and fresh USB drive to use.

Extract the Install Files

With Windows 8+ you can just right-click and select “Mount” on the iso. Copy all of the files to the USB drive.

With Windows 7, you’ll need a program like 7-zip. Open the ISO, and extract all files to the USB drive.

Mount the WIM

There are two WIM’s in your Windows Installer that we’re concerned about: <InstallRoot>\sources\boot.wim and <InstallRoot>\sources\install.wim.

  • The Boot.wim is what gets loaded when you boot to your install media. This is a WinPE image used to apply an OS–MDT/SCCM people will be very familiar with the boot media concept.
  • The install.wim file is the actual sysprepped OS Installation that will get applied to your hard drive. If you mounted this, it will look just like your C drive: Program Files, Windows, Users, etc…

So really we now dive to 2 scenarios:

  1. When you boot to your media, your hard drive (or other device) is not recognized.
  2. When Windows is installed, drivers are missing

Scenario 1 relates to your boot media, scenario 2 relates to the install.wim. A rule of thumb is that your boot.wim only needs essential drivers; eg: storage and network. In this scenario, we’re only concerned about storage, since we’re using USB as our source media. Really though, both processes are the same.

  1. Open an Administrative Command prompt.
  2. Create a directory to mount the WIM file (mkdir c:\mount)
  3. Mount the wim:
dism /mount-wim /wimfile:%PathToWimFile% /Index:1 /mountdir:%ImageMountDir%

Add in the Drivers:

To add the drivers we’ll need to point the command to the folder of drivers we created above.

REMEMBER: only add storage and network to boot.wim. Anything more is just silly.

If you have you install.wim mounted you can point to the top folder that contains all the drivers for your model. Example: c:\drivers\hp\EliteBook800SeriesG1

Add the drivers:

dism /image:%ImageMountDirFromAbove% /add-driver /driver:%PathToDriversFolder% /recurse /forceunsigned

The recurse option will check all sub folders. the forceunsigned will allow unsigned drivers to be added.

On Windows 8.1 while mounting my Windows 10 install.wim i was greeted with an error:

Deployment Image Servicing and Management tool
Version: 6.3.9600.17031
Error: 50

To service this Windows image requires the latest version of the DISM. See to find the latest version of DISM, and to learn how to install the latest version of DISM from the ADK on your computer.

The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

We could look at the dism log if we wanted but to me this error is rather self-explanatory. Essentially this is saying that the OS i have mounted is newer than the dism tool i’m using. Dism version: 6.3.9600.17031…Windows 8.1 OS Version is 6.3.9600 (see what they did there?). Think of it this way: Each version supports the corresponding Windows release plus older (Backwards compatible). It cannot work with a newer version since older version doesn’t know what newer version is.

The fix for this is to use the DISM command included in the Windows setup disk. Rerun the dism command above but this time, we’ll need to use the full path to the Windows 10 media:

%PathToWindowsInstallMedia%\Sources\dism.exe  /image:%ImageMountDirFromAbove% /add-driver /driver:%PathToDriversFolder% /recurse /forceunsigned

And voila…now we have drivers added.

Save the Changes

Last thing is to commit the changes we made:

%PathToWindowsInstallMedia%\Sources\dism.exe  /unmount-wim /mountdir:%ImageMountedDir% /commit

Again, this process will really apply to any version of Windows where you’d like to inject drivers within your media!




19 thoughts on “Inject Drivers to Windows 10 Install Media

  1. Thank you! This is invaluable with the new NVMe media and getting Windows to install to it. Add the Samsung NVMe driver to the Boot.wim and Bob’s your uncle! Or something like that… I’ts the dog’s bollocks!? Whatever, it works!

  2. Getting Error 193 after trying the DISM from the Windows media. A laptop with NO DVD drive is useless to install Windows 10!

  3. Hi, is there any limitation on how often I can mount / dismount a WIM? I heard there are limitations but I do not know what this assumption in based on.

  4. Ran into the same error with using Windows 8.1 DISM with Windows 10 based WIMs. Smart move to use the DISM on the Windows 10 ISO media, it loaded up as version 10.whatever and worked great. Saved me some time from having to dig up a test Windows 10 device with the ADK and whatnot installed!

  5. Hi, thank you for this info.

    I can’t figure out the part about mounting the boot.wim file. It always give me an error02: The system cannot find the file specified.

    I’m not sure how, when the boot file is in the thumbdrive & the command line is run on the windows directory & there’s a directory in c:\ How do you select the file in thumbdrive & run it on the command line & then point the mounted files to c:\ directory?

    I need a much more explicit explanation. Thank you.

    • Many answers to this…best way is to cd to the directory that dism is in. That way the dism and supporting libraries are in the working directory. From there you’ll want to fully qualify the path to the wim. Normally Windows (and any other shell prompts on other operating systems) assume any reference you make is in the working directory.

      If you’re doing this on a non Windows 10 os, make sure you have the latest adk installed and are using the “deployment and imaging tools environment” provided with that install.

  6. C:\Windows\system32>E:/sources/dism.exe /unmount-wim /mountdir:c:\mount\install.

    Deployment Image Servicing and Management tool
    Version: 6.1.7601.17514

    Error: 87

    The unmount-wim option is unknown.
    For more information, refer to the help by running DISM.exe /?.

    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    How can i fix this?

    • You can lookup the dism syntax or issue the /? Command it’s directing you too. I believe that the dism syntax has changed to be /unmount-image. Many of the direct references to “wim” have been altered since dism supports more than just wim fules

  7. I tried to inject virtiodrivers to windows10.
    dism failed with the error you described.

    As recommended by you ..
    path_to_the_unpacked_w10/sources/dism shows
    DISM.exe /Mount-Wim /? ( note the upper cases)

    But when I execute the full command

    path_to_the_unpacked w10/sources/dism /Mount-Wim ..
    it failes with error 87
    option mount-wim (note the cases) is unknown
    and the well known
    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    May it be the newer dism uses dlls of the older OS, because of the different notation of mount-wim in the error message?
    Is there something like LD_LIBARY_PATH of LInux to use the newers dlls in Windows too?
    Any other solution you can offer?

  8. Do you think that adding the usb 3.0 drivers would allow to setup from a 3.0 usb drive? That should speed all the process up…

  9. So if i want to add multiple drivers for laptops model in windows 10 iso can do that and makes windows choose which drivers suitable for current machine that running the installation ?

    • Regardless of what our load into the image windows will still do an automatic scan for matching drivers. Forcing a specific driver to a specific device id will require additional scripting

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s