Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / Windows 10 / How to Inject Drivers into a Windows 10 WIM/ISO Install Image?

January 15, 2019 Windows 10Windows Server 2012 R2Windows Server 2016

How to Inject Drivers into a Windows 10 WIM/ISO Install Image?

In this article, we will show you how to add the necessary device drivers directly into the Windows installation image. The integration of the device drivers into your offline Windows image is widely used when you need to deploy a large number of workstations and servers on the same hardware. Instead of manually installing specific drivers (including AHCI/ RAID/ NVMe) on each device, you can significantly simplify and accelerate OS deployment process by integrating the drivers directly into the Driver Store of the Windows installation image in the ISO/WIM or the VHD/VHDX file. When installing such an image, the Plug and Play service (PnP) will automatically install the necessary drivers for the detected hardware.

This manual is about the integration of device drivers into a Windows image and can be used both on desktop editions of Windows 10, Windows 8.1 and on Windows Server 2016, 2012 R2.

In modern Windows editions you can add drivers to the installation ISO image in two ways:

  • using the DISM utility;
  • using the PowerShell CLI.

In fact, both techniques perform the same operation: add additional drivers into the offline Windows image. How to use it is a matter of personal administrator preference. Let us consider in more detail both ways on the example of integrating drivers into the Windows 10 installation image.

Note. In Windows Server 2008 R2 and Windows 7, it was possible to add a driver to the Windows installation image using the imagex command line tool (included into the WAIK), but it is not supported in Windows Server 2012 and later.

Contents:
  • How to Inject Driver into a Windows 10 Install Image using PowerShell?
  • Adding Drivers to an Offline Windows Server 2012 R2 Image Using DISM

How to Inject Driver into a Windows 10 Install Image using PowerShell?

First of all you need to download and place all the necessary device drivers in one directory (for each driver you need to create a separate folder). Please note that many vendors (including Dell, HP) supply their drivers in the form of self-extracting exe or zip archive files. Such archives must be unpacked to local drive so that the directory with drivers contains inf, cat and sys files.

Before you start, create the following directory structure on your local drive:

  1. The Drivers folder – it contains unpacked driver files for your Windows 10 edition (which are supposed to be integrated into the install media);
    You can download and unpack the necessary driver files manually or export all third-party drivers from a reference Windows 10 computer, on which all the necessary drivers are already installed (using the Export-WindowsDriver cmdlet).
  2. The ISO folder – this directory contains the unpacked iso image of Windows 10. You only need the Install.wim file from the Sources directory;
    If your Windows 10 ISO image contains only the file ..\sources\install.esd, you can convert the ESD file to WIM format using the DISM tool: dism /export-image /SourceImageFile:"C:\WinWork\ISO\install.esd" /SourceIndex:4 /DestinationImageFile:C:\WinWork\ISO\install.wim /Compress:max /CheckIntegrity  dism convert install.esd to install.wim  
  3. The Mount folder – an empty directory into which the Windows install WIM image will be mounted later.how to add drivers into a Windows 10 image

List all Windows editions contained in the Install.wim file using the Get-WindowsImage PowerShell cmdlet. This is necessary in order to specify the Widows edition into which it is planned to integrate the additional drivers.

Get-WindowsImage -ImagePath C:\WinWork\ISO\install.wim

Get-WindowsImage install.wim

In our example, the WIM file contains only one Windows 10 Pro edition with the index 1 (ImageIndex: 1).
Next you need to mount the image of the selected Windows edition in the directory Mount. The Windows image index, which you need to mount, must be specified as an argument of the Index parameter:

Mount-WindowsImage -Path C:\WinWork\Mount\ -ImagePath C:\WinWork\ISO\install.wim -Index 1

Mount-WindowsImage install.wim

After the image is mounted, you can add drivers to it from the Drivers directory using the command:

Add-WindowsDriver -Path C:\WinWork\Mount\ -Driver C:\WinWork\Drivers -Recurse

The Add-WindowsDriver cmdlet will recursively search (the -Recurse parameter) the specified folder for all *.inf files with driver description. According to the description in the inf file, the cmdlet will add the dependent INF, DLL, CAT, PNF, etc. files to the Driver Store of your Windows image.

Add-WindowsDriver powershell cmdlet to inject drivers to the offline install.wim image

Using the –ForceUnsigned key, you can add to the driver store even an unsigned drivers. Otherwise, you will have to disable the digital signature enforcement or sign the device driver yourself with a self-signed certificate.

So, the drivers are copied, and the current image can be unmounted with saving changes:

Dismount-WindowsImage -Path C:\WinWork\Mount\ –Save

Dismount-WindowsImage - save changes

In the above example, we added drivers to the Install.wim image file. This is the Windows image that will be deployed to a computer local disk. If you need to add drivers to a Windows boot image (from which the computer boots when you install Windows), you need to add drivers to the Boot.wim file. This is usually necessary when installing Windows, the computer doesn’t detect local hard drives or doesn’t connect to LAN. Usually, only drivers of disk controllers and network adapters need to be integrated into the boot.wim image.

Please note that over time, the driver store folder (%WINDIR%\System32\DriverStore\FileRepository) can grow significantly, so you need to remove unused and old driver versions from driver store periodically.

You can convert your install.wim file containing the Windows installation image with integrated drivers into the install.esd format using the DISM compress option:

DISM /Export-Image /SourceImageFile:C:\WinWork\ISO\install.wim /SourceIndex:1 /DestinationImageFile:C:\WinWork\ISO\install.esd /Compress:recovery

It remains to create an ISO file using Dism++ or the oscdimg command and write it to a disk or USB flash drive:

oscdimg -n -m -bc:\ISO\boot\etfsboot.com C:\ISO C:\new_win10pro_image.iso

There is no Add-WindowsDriver cmdlet in Windows 7 / 2008R2. It appeared only in Windows 8/ Windows Server 2012 and later, therefore to integrate drivers into an image of Win7/2008 R2, use the DISM tool (see the example below or in the article Adding the USB 3.0 Drivers In Windows 7 Installation).

Adding Drivers to an Offline Windows Server 2012 R2 Image Using DISM

Now we will show an example of integrating drivers into the install image of Windows Server 2012 R2. If you are building an image on Windows 8.1, you will need to download and install Windows 8 ADK (http://www.microsoft.com/en-us/download/details.aspx?id=30652) to continue working with the latest version of DISM. You need to install the Deployment Tools component.

Windows 8 ADK Deployment Tools

Use the same directory structure: Drivers (drivers and *.inf files are stored), ISO (unpacked image of Windows Server 2012 R2), Mount (image mount directory). It is assumed that in the install.wim file we are interested in the Windows Server 2012 R2 Datacenter edition with index 3.

Mount the install.wim installation image:

dism /Mount-Wim /WimFile:c:\iso\sources\install.wim /Index:3 /MountDir:c:\mount

Run a recursive search and integration of the new drivers into the driver store of the Windows Server 2012 R2 image:

dism /image:c:\mount /Add-Driver "/driver:c:\drivers\" /recurse

Save the changes to the WIM image:

dism /unmount-wim /mountdir:d:\mount /commit

You may also have to integrate drivers for network adapters and disk controllers into the boot image file boot.wim.

If you need to add drivers to all Windows Server editions contained in the wim file, these operations must be performed for all indexes of OS versions that the command returned:

dism /get-wiminfo /wimfile:d:\install.wim

dism /get-wiminfo

In addition to driver integration, it is usually necessary to inject security updates to the Windows image to be installed (How to add updates into the Windows installation image). This will increase the security of your OS immediately after the installation. It remains to write the resulting installation image to the DVD disk or USB flash drive or convert it to the ISO image.

8 comments
3
Facebook Twitter Google + Pinterest
previous post
Managing Printers from the Command Prompt in Windows 10 / 8.1
next post
Unable to Start or Connect to Virtual Disk Service in Disk Management

Related Reading

How to Sign a PowerShell Script (PS1) with...

February 25, 2021

How to Shadow (Remote Control) a User’s RDP...

February 22, 2021

Configuring PowerShell Script Execution Policy

February 18, 2021

Configuring Proxy Settings on Windows Using Group Policy...

February 17, 2021

Updating Group Policy Settings on Windows Domain Computers

February 16, 2021

8 comments

Peter May 11, 2019 - 1:48 pm

Thanks for posting found it very helpful.

Reply
ayyu3m November 8, 2019 - 8:29 am

There is a missing double co colon right after SourceImageFile when trying to convert back to install.esd

DISM /Export-Image /SourceImageFile:C:\WinWork\ISO\install.wim /SourceIndex:1 /DestinationImageFile:C:\WinWork\ISO\install.esd /Compress:recovery

Reply
j00d July 20, 2019 - 1:36 pm

for the

oscdimg -n -m -bc:\ISO\boot\etfsboot.com C:\ISO C:\new_win10pro_image.iso

you got all the paths wrong, it should be c:\winwork\iso you are missing that directory in your sample

Reply
Kattz July 22, 2019 - 6:24 am

I have 3 oddball Windows 10 tablets. I have Windows System Image backups for them, but Windows can’t see them. I just really need the driver’s from the images. Would I be able to extract them from the images using any of the above methods? I’m frustrated and confused at this point. I’ve tried many different things and nothing has worked. I would appreciate any advice. Thanks.

Reply
admin July 22, 2019 - 1:26 pm

Mount your vhdx file from your Windows System State Backup to a separate drive letter (for instance, e:) and try to export the installed device drivers from your offline image as follow:

Export-WindowsDriver -Path e:\windows -Destination c:\DriverBackup

Reply
Scott May 12, 2020 - 1:33 am

DISM /Export-Image /SourceImageFile C:\WinWork\ISO\install.wim /SourceIndex:1 /DestinationImageFile:C:\WinWork\ISO\install.esd /Compress:recovery

“C:\WinWork\ISO\install.wim”

Is not a known command-line option.

Reply
admin May 15, 2020 - 6:20 am

The colon is missing right after SourceImageFile. I fixed the command in the post. Thanks!
You should use the command:
DISM /Export-Image /SourceImageFile:C:\WinWork\ISO\install.wim /SourceIndex:1 /DestinationImageFile:C:\WinWork\ISO\install.esd /Compress:recovery

Reply
Juan Pedro October 14, 2020 - 5:44 am

Excellent tutorial. Thank you.
Just as mentioned by J00D, the path for the creation of the ISO need to be commented.

.\oscdimg -n -d -m -bC:\WinWork\Original\iso\boot\etfsboot.com C:\WinWork\Original\iso\ C:\WinWork\new_win10pro_image.iso

Where “C:\WinWork\Original\iso\” is the location of the full original content of the ISO. The one expanded at the very beginning.

Also, “oscdimg” can be downloaded from https://answers.microsoft.com/en-us/windows/forum/windows_7-windows_install/where-is-oscdimgexe/b6ccd22e-b478-4222-b370-d5aaf021f575

And you could add to “oscdimg” the parameter “-d” to keep the case definition (lower or upper).

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • Accessing USB Flash Drive from VMWare ESXi

    February 26, 2021
  • How to Sign a PowerShell Script (PS1) with a Code Signing Certificate?

    February 25, 2021
  • Change the Default Port Number (TCP/1433) for a MS SQL Server Instance

    February 24, 2021
  • How to Shadow (Remote Control) a User’s RDP session on RDS Windows Server 2016/2019?

    February 22, 2021
  • Configuring PowerShell Script Execution Policy

    February 18, 2021
  • Configuring Proxy Settings on Windows Using Group Policy Preferences

    February 17, 2021
  • Updating Group Policy Settings on Windows Domain Computers

    February 16, 2021
  • Managing Administrative Shares (Admin$, IPC$, C$, D$) in Windows 10

    February 11, 2021
  • Packet Monitor (PktMon) – Built-in Packet Sniffer in Windows 10

    February 10, 2021
  • Fixing “Winload.efi is Missing or Contains Errors” in Windows 10

    February 5, 2021

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Allow Multiple RDP Sessions in Windows 10?
  • How to Repair EFI/GPT Bootloader on Windows 10?
  • How to Restore Deleted EFI System Partition in Windows 10?
  • Network Computers are not Showing Up in Windows 10
  • Booting Windows 7 / 10 from GPT Disk on BIOS (non-UEFI) systems
  • How to Run Program without Admin Privileges and to Bypass UAC Prompt?
  • Removable USB Flash Drive as Local HDD in Windows 10 / 7
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top