During investigation or testing you might need to add any drivers to some already prepare/captured .wim image you have – either WinPE boot image (where you want to add network or storage drivers) or captured full OS image (where you can add any drivers).
Procedure is quite simple. First, prepare a folder where you will place all extracted driver files you wish to import. Note that it will not work with .exe/zip files, you need to extract those first until you get the original .inf and other files. You don’t need to worry about folder structure, the command will search all subfolders recursively. In this case, the drivers are prepared at C:\drivers,
Next, you will need to create an empty folder where DISM can extract your WIM file, so it can make the desired import. In this case, that is C:\mount folder.
In the example, the WIM file is ready at D:\sources\boot.wim.
You will need to know also the index of the image that is in the WIM file. For boot images, it will be usually 1, but if you have many OS placed in the wim file, you can check the exact index by the command in elevated Powershell:
Get-WindowsImage -ImagePath "D:\sources\boot.wim"
Then open CMD/Powershell as admin and follow:
Use this DISM command to mount your .wim image: DISM /Mount-Wim /WimFile:D:\sources\boot.wim /Index:1 /MountDir:C:\mount\ Use the following DISM command to add the driver: DISM /Image:C:\Mount\ /Add-Driver /Driver:C:\drivers /recurse Use the following DISM command to unmount and commit the boot.wim: DISM /Unmount-Wim /MountDir:C:\mount\ /Commit
After all this, your WIM file now contains all the drivers you prepared.