In this blog article, I am going to show you how you can add drivers to a Windows Server 2019 ISO Image or WIM file using PowerShell and the DISM module. This will allow you to already have the latest drivers within the Windows Server installation image when you install Windows Server 2019. We will add drivers to a Windows Server 2019 WIM file (WIM stands for Windows Imaging Format), which then can be used to create a new ISO image or for example in Windows Deployment Services.
Preparation
First, you will need to create three new folders called Drivers, ISO, and Mount. In my example, I created these in C:\Images.
- Drivers – This is the folder where you put all your extracted drivers, which you want to add to your Windows Server 2019 Image.
- ISO – This is where you can extract the Windows Server 2019 ISO Image. Basically all the files on the ISO file.
- Mount – This is an empty folder, which will be used to mount the WIM files.
You can now mount the ISO using Windows Explorer or the following PowerShell commands and copy the files to the ISO folder.
Mount-DiskImage -ImagePath C:\Temp\17763.379.190312-0539.rs5_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso Copy-Item D:\* C:\Image\ISO\ -Recurse
In your case, the ISO may be mounted on a different drive letter instead of my D: drive.
Add drivers to the Windows Server 2019 Image
First, you can check in which Windows editions you want to add the drivers. To check that you can use the following PowerShell command:
Get-WindowsImage -ImagePath C:\Image\ISO\sources\install.wim
The Get-WindowsImage cmdlet will show you the different editions included in the WIM file.
After we have seen the Index numbers, we can now mount the Windows Image our Mount folder. In my example, I use Image Index 3, which is the Windows Server 2019 Datacenter Core Edition. If you want to check which editions of Windows Server 2019 you should use, check out the Microsoft Docs.
Mount-WindowsImage -Path C:\Image\Mount -ImagePath C:\Image\ISO\sources\install.wim -Index 3
After the image is mounted you can now add the drivers to the Windows Server 2019 Image using the following command:
Add-WindowsDriver -Path C:\Image\Mount -Driver C:\Image\Drivers -Recurse
After you have added all the drivers to the image, you need to dismount the image and save it.
Dismount-WindowsImage -Path C:\Image\Mount -Save
We have now added the drivers to the Install image, and you should also add the drivers to your boot image if it is, for example, a network or storage controller driver you might need to install the server. To do this do the same steps to the C:\Image\ISO\sources\boot.wim.
Now you can use these WIM files with Windows Deployment services or create a USB drive to install Windows Server 2019. If you want to create an ISO file, you can use the oscdimg command-line tool. The oscdimg tool comes with the Windows Assessment and Deployment Kit (Windows ADK), which you can get here.
oscdimg -n -m -bc:\temp\ISO\boot\etfsboot.com C:\temp\ISO C:\temp\mynew.iso
I hope this post helps you to add drivers to your Windows Server image. If you have any questions, feel free to leave a comment.
Tags: add, Create ISO, drivers, Image, Install Windows Server, iso, ISO Drivers, Microsoft, Operating System, PowerShell, WIM, Windows Server, Windows Server 2019, Windows Server 2019 Image, Windows Server 2019 ISO Image Last modified: July 8, 2019
I am guessing the same procedure works for Windows 10.
Yes it does :)
I have followed this guide over and over (and other’s I’ve found that use the DISM command to add drivers) and for some reason, I cannot get a bootable ISO image from this. I feel like I’m missing something but every step completes without error. After modifying either the install.wim or boot.wim files and creating the ISO file with the oscdimg command you have listed, and I can never boot to the new ISO file that was created. I know my original ISO file that all the files were copied from is good as I already have VMs built from the original.
Would you be able to offer any help on this? I’ve tried to Google-fu my way out of it, but haven’t come across anyone else that seems to have any issues after adding the drivers and re-creating an ISO from it.
mount dont work. not the permission or rights for read/write ????
Did you open PowerShell as Administrator? :)
Make sure to remove the read only atrribut on the folder in which the iso is mounted
and run this command
Set-ItemProperty -Path c:\Image\ISO\sources\boot.wim -Name Attributes -Value Normal
I get at the end on the install process an error – install.wim is corrupt.
It’s fine
References are missing. Drivers must be added to boot.wim and install.wim
@Joshua Jacques:
Found the solution: oscdimg has to be run with the -u2 parameter instead of the -n parameter, otherwise it’s not copying the full install.wim to the ISO if the install.wim is bigger than 4GB
Just like Joshua Jacques I get all steps completed and the final ISO is not bootable.
I added storage drivers to install.wim and boot.win
Any ideas?
For any one else coming here and finding that after following all the directions the ISO still wouldn’t boot, I have found a command line for oscimg that did work for me.
oscdimg -u2 -m -udfver102 -o -lWin2019 -bootdata:2#p0,e,bD:\ISO\boot\etfsboot.com#pEF,e,bD:\ISO\efi\microsoft\boot\efisys.bin D:\ISO E:\WS20193.ISO
the formatting may break so line by line here are the options:
-u2
-m
-udfver102
-o
-lWin2019
-bootdata:2#p0,e,bD:\ISO\boot\etfsboot.com#pEF,e,bD:\ISO\efi\microsoft\boot\efisys.bin
D:\ISO
E:\WS20193.ISO
I used ‘D:\ISO’ and E:\ as my paths, so you will need to change these to match what you used.
Hope that helps
@John,
Thank you for that. I may go back and try this at some point with the options you mentioned, I just gave up on it since I had issues for so long. :)
@kache,
Thank you for your input as well! I never went back and tried it with that option but it sounds like you were on the right track!
Hey John,
Thanks a lot, I was missing the correct path for efisys.bin (it differs between windows 10 and windows 2019).
I’m not even getting the drivers to copy, let alone a bootable ISO!! So obviously I’m going wrong somewhere.. I get “WARNING: DISM has skipped driver signature check because the version of running OS and that of target OS do not match.” No wonder as I’m trying to create a Windows 7 ISO to install alongside (within) Windows 10. Am I barking up the wrong tree here?
I get as far as adding the drivers, but get: “PS C:\> Add-WindowsDriver -Path C:\Image\Mount -Driver C:\Image\Drivers -Recurse
WARNING: DISM has skipped driver signature check because the version of running OS and that of target OS do not match.” every time.
It’s obvious why – I’m doing this inside Windows 10 to add drivers to a Windows 7 ISO for a dual boot setup.
So how do I get round this? HELP!!
For anyone unable to make a bootable iso, i’ve used those arguments and it finally worked:
Oscdimg -bootdata:2#p0,e,bC:\Image\ISO\boot\etfsboot.com#pEF,e,bC:\Image\ISO\efi\microsoft\boot\Efisys.bin -u1 -udfver102
C:\Image\ISO C:\Image\Windows2019Custum.iso
Hi Thomas
A really good guide for adding drivers to a Win 2019 ISO.
Could you please add a couple of lines for how to add CU’s to the Win 2019 ISO?
Thanks
Michael
Good idea, I will have a look at updating the post when I find some time.