If you add all the necessary drivers to the drive store of your Windows install image, you can simplify the deployment of the operating system to specific workstations (servers). In this case, after installing Windows, you do not need to manually download and install specific drivers (including AHCI/RAID/NVMe) on each computer.
In this article, we will show you how to integrate device drivers directly into Windows 10 offline install image (it can be an ISO/WIM file or a VHD/VHDX file with OS template). The instruction is applicable for all supported versions of Windows 11, 10, 8.1 and Windows Server 2022, 2019, 2016 and 2012 R2.
In current Windows versions, you can add drivers to the installation ISO image in two ways:
- use of December tool,
- with powershell CLI,
Comment, In Windows Server 2008 R2 and Windows 7, it was possible to add a driver to the Windows installation image using ImageX Command line tool (included WAIK), but it is not supported in Windows Server 2012 and later.
Inject Drivers into Windows Install Image Using PowerShell
Download and copy all required device drivers to one directory (you need to create a separate folder for each driver). Please note that many vendors (including Dell, HP, Lenovo, etc.) supply their drivers as self-extracting exe or zip archive files. Such an archive must be unpacked on the local disk so that the inf, cat, and sys files are located in the directory with the driver.
Before we begin, create the following directory structure on your local drive:
- drivers folder – contains the unpacked driver files for your computer (which should be integrated into the Windows 10 install media);
You can manually download and extract the required driver files or export all third-party drivers from a reference Windows 10 computer that has all the required drivers already installed using the Export-WindowsDriver cmdlet.
- ISO Folder – This directory contains the extracted Windows 10 ISO image. you only need install.wim file from the source directory;
- Mountain Folder – An empty directory in which the Windows installed WIM image will be mounted.
List all windows versions contained in install.wim file using get-windows image powershell cmdlet. This will allow you to get an index of the Windows version into which you plan to integrate additional drivers.
Get-WindowsImage -ImagePath C:\WinWork\ISO\install.wim
In our example, the WIM file contains only a Windows 10 Pro version with index 1 (Image Index: 1,
DISM /export-image /SourceImageFile:"C:\WinWork\ISO\install.esd" /SourceIndex:4 /DestinationImageFile:C:\WinWork\ISO\install.wim /Compress:max /CheckIntegrity
Next, you need to mount the selected Windows version image to the mount directory. as an argument index parameter, specify the index of the Windows image you want to mount:
Mount-WindowsImage -Path C:\WinWork\Mount\ -ImagePath C:\WinWork\ISO\install.wim -Index 1
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
add-windows driver The cmdlet will recursively scan the specified folder (-Recurse parameter) for all *.inf files with driver details. inf file, the cmdlet will add dependent INF, DLL, CAT, PNF, etc. files to your Windows image’s offline driver store.
After copying the driver’s files, make your changes and unmount the WIM image.
Dismount-WindowsImage -Path C:\WinWork\Mount\ –Save
In this example, we have added drivers to the install.wim image file. This is the Windows image that will be deployed to the computer’s local drive. If you need to add drivers to the Windows boot image (the WinPE environment used to boot the computer and run Windows Setup), you need to add the drivers boot.vim file. This is usually required when Windows Setup does not detect the local hard drive, video, or network adapter. Typically, it is sufficient to simply add drivers for disk controllers or network adapters to the boot.wim image.
You can convert your install.wim file to the install.esd format containing the Windows installation image with the integrated drivers by 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 tool and write it to a disk or USB flash drive:
oscdimg -n -m -bc:\WinWork\ISO\boot\etfsboot.com C:\WinWork\ISO C:\new_win10pro_image.iso
This command will create an ISO image for installation on a computer with BIOS firmware or in UEFI legacy mode (CSM/Compatible Support Mode).
To generate a universal ISO image with both UEFI and BIOS support, use the command:
oscdimg.exe -h -m -o -u2 -udfver102 -bootdata:2#p0,e,bc:\winwork\iso\boot\etfsboot.com#pEF,e,bc:\winwork\iso\efi\microsoft\boot\efisys.bin -lWin10 c:\iso c:\new10image.iso
To burn an ISO image file to a USB flash drive, the easiest way is to use rufus utility.
You can now use your custom image to deploy Windows to a computer from a local boot device (USB disk or flash drive) or install Windows over a network (using PXE boot).
Add drivers to an offline Windows Server image by using DISM
We will now show an example of adding drivers to the Windows Server 2022 install image.
Use the same directory structure: drivers (drivers and *.inf files are stored here), ISO (Unpacked image of Windows Server 202), Mountain (image mount directory). All image modification operations are performed from a Windows 10 desktop computer.
List the versions in a WIM file:
Dism /Get-ImageInfo /imagefile:"C:\iso\sources\install.wim"
In this example, I am going to inject the drivers with the Windows Server 2022 Standard (Desktop Experience) image Index: 2,
Mount the install.wim installation image:
dism /Mount-Wim /WimFile:c:\iso\sources\install.wim /Index:2 /MountDir:c:\mount
Now search for drivers (recursively) and add new drivers to the driver store of the Windows Server 2022 image:
dism /image:c:\mount /Add-Driver "/driver:c:\drivers\" /recurse
You will see the following message for each successfully added driver:
driver.inf: The driver package was successfully installed.
Save changes to a WIM image:
dism /unmount-wim /mountdir:d:\mount /commit
You may also need to add drivers for network adapters and disk controllers to the boot image file. boot.wim,
If you want to add drivers to all Windows Server versions contained in the installation image, you must follow these steps to index all in the install.wim file.
Remove driver package from Windows image
In some cases, you may need to remove drivers from the Windows WIM installation image (when removing outdated/incorrect drivers, or reducing the size of the ISO image).
To do this, mount the offline WIM image to a local folder:
Mount-WindowsImage -Path C:\Mount\ -ImagePath C:\iso\sources\install.wim -Index 2
List third-party drivers in an offline Windows image:
Get-WindowsDriver -Path "c:\Mount"
To remove a specific driver, you must specify its inf filename (Om<संख्या>.Information,
Remove-WindowsDriver -Path "c:\offline" -Driver "OEM0.inf"
You can extract specific vendor drivers from an image. In this example, we’ll remove all Intel drivers:
$drivers = get-windowsdriver -path C:\mount
$drivers | where-object {$_."ProviderName" -eq 'Intel' } | Remove-WindowsDriver -Path C:\Mount
Make changes to a WIM image file:
Dismount-WindowsImage -Path C:\Mount -save
Leave a Comment