The following steps can be used to inject drivers to a Windows 11 installation ISO.
In my case the wireless adapter for the laptop that Windows 11 is being installed on requires a driver to be installed before being able to use it. This breaks Windows Autopilot since the network can't be setup on the OOB screen.
Gather the relevant files:
I will use the following directory structure for building the image:
C:\Image\Drivers: All of the drivers are extracted hereC:\Image\Mount: An empty directory; the install image will be mounted hereC:\Image\ISO: The ISO contentsExtract the ISO into C:\Image\ISO. I am using 7-Zip to do this.
The install image needs to be mounted.
First, get the ImageIndex from install.wim for the image you will be installing. This can be retrieved by using the Get-WindowsImage cmdlet:
Get-WindowsImage -ImagePath C:\Image\ISO\sources\install.wim
This should give output like this:
ImageIndex : 1
ImageName : Windows 11 Education
ImageDescription : Windows 11 Education
ImageSize : 16,322,744,196 bytes
ImageIndex : 2
ImageName : Windows 11 Education N
ImageDescription : Windows 11 Education N
ImageSize : 15,629,961,328 bytes
ImageIndex : 3
ImageName : Windows 11 Enterprise
ImageDescription : Windows 11 Enterprise
ImageSize : 16,322,866,211 bytes
In my case I will be using the Enterprise release, so the ImageIndex is 3.
The image can now be mounted:
Mount-WindowsImage -Path C:\Image\Mount -imagepath C:\Image\ISO\sources\install.wim -index 3
The drivers can now be added to the image:
Add-WindowsDriver -Path C:\Image\Mount\ -Driver C:\Image\Drivers -Recurse
Since the -Recurse parameter is used, drivers will be added recursively.
The image can now be unmounted and saved:
Dismount-WindowsImage -Path C:\Image\Mount -Save
The new ISO can now be built.
For UEFI and BIOS mode to work:
C:\Image\oscdimg.exe -m -o -u2 -udfver102 -bootdata:2#p0,e,bC:\Image\ISO\boot\etfsboot.com#pEF,e,bC:\Image\ISO\efi\microsoft\boot\efisys.bin C:\Image\ISO C:\Image\Windows-11-Injected-Drivers.iso
Otherwise for BIOS only:
C:\Image\oscdimg.exe -n -m -bC:\Image\ISO\boot\etfsboot.com C:\Image\ISO C:\Image\Windows-11-Injected-Drivers.iso
Once completed the ISO should be located in the path C:\Image\Windows-11-Injected-Drivers.iso.