Table of Contents
You can simplify the deployment of the operating system on typical workstations (servers) if you add all the necessary drivers to the Drive Store of your Windows installation USB stick. In this case, after installing Windows, you don’t have to manually download and install specific drivers (including AHCI/RAID/NVMe or network cards) on each computer.
Before you begin
- Download a Windows ISO from Microsoft.
- We use drive E for example, don’t forget to replace it in the below commands.
Mount Windows installation image
1️⃣ Right click on the downloaded iso file then mount it into your computer.
In this case, the image mounted to the drive letter F.
Add Drivers into Windows USB Boot Device
2️⃣ Right click on the Windows Start icon then open PowerShell or Terminal as administrator.
3️⃣ Create three folders, in this case we’ll create the folders in the E drive.
New-Item E:\drivers, E:\wim, E:\iso -Type Directory
4️⃣ Copy all files and folders from mounted drive (F:\) into E:\iso folder.
5️⃣ Copy drives in to E:\drivers folder. You can create sub-folders for each driver if you want to keep things organized. The driver files will usually be in the form of .inf, .sys, and .cat files. Example below:
6️⃣ Now we have to find the index number of the OS edition. In this example we have a Wndows 10 (22H2) image, we will use PRO edition to add drivers to, so let’s go for the index number 6.
dism /Get-WimInfo /WimFile:E:\iso\Sources\install.wim
#Output Deployment Image Servicing and Management tool Version: 10.0.22621.1 Details for image : F:\Sources\install.wim ... Index : 6 Name : Windows 10 Pro Description : Windows 10 Pro Size : 15,435,570,649 bytes ... The operation completed successfully.
7️⃣ Now we have to mount the image of your preferred Windows edition (in this example Windows 10 Pro) using it’s index number to E:\wim folder.
dism /Mount-Image /ImageFile:E:\iso\Sources\install.wim /Index:6 /MountDir:E:\wim
#Output Deployment Image Servicing and Management tool Version: 10.0.22621.1 Mounting image [==========================100.0%==========================] The operation completed successfully.
8️⃣ You can use this command for adding all the drivers in the folder and subfolders from E:\drivers to E:\wim.
dism /Image:E:\wim /Add-Driver /Driver:E:\drivers /Recurse /ForceUnsigned
#Output Deployment Image Servicing and Management tool Version: 10.0.22621.1 Image Version: 10.0.19043.928 Searching for driver packages to install... Found 2 driver package(s) to install. Installing 1 of 2 - E:\temp\drivers\WLAN\netrtwlane.inf: The driver package was successfully installed. Installing 2 of 2 - E:\temp\drivers\WLAN\netrtwlane_ext_dmar.inf: The driver package was successfully installed. The operation completed successfully.
9️⃣ When all drivers are added, we have to commit the changes to the Windows image.
dism /Unmount-Image /MountDir:E:\wim /Commit
#Output Deployment Image Servicing and Management tool Version: 10.0.22621.1 Saving image [==========================100.0%==========================] Unmounting image [==========================100.0%==========================] The operation completed successfully.
Install the Windows ADK and create custome ISO file
Next, we need the Windows Assessment and Deployment Kit (Windows ADK) to build the custom ISO file from the committed image in E:\iso.
You can download then install Windows ADK from this link.
1️⃣ When installing the Windows Assessment Toolkit, you just need to install Deployment Tools only.
2️⃣ Once the tools installed, you can find Deployment and Imaging Tools then run it as administrator.
3️⃣ We can now create the Installation media using the oscdimg command.
oscdimg.exe -m -o -u2 -udfver102 -bootdata:2#p0,e,bE:\iso\boot\etfsboot.com#pEF,e,bE:\iso\efi\microsoft\boot\efisys.bin E:\iso E:\Windows.iso
#Output OSCDIMG 2.56 CD-ROM and DVD-ROM Premastering Utility Copyright (C) Microsoft, 1993-2012. All rights reserved. Licensed only for producing Microsoft authorized content. Scanning source tree (500 files in 41 directories) Scanning source tree complete (906 files in 86 directories) Computing directory information complete Image file is 6153961472 bytes (before optimization) Writing 906 files in 86 directories to E:\Windows.iso 100% complete Storage optimization saved 25 files, 14182400 bytes (1% of image) After optimization, image file is 6141843456 bytes Space saved because of embedding, sparseness or optimization = 14182400 Done.
4️⃣ We no longer need the folders that be created in the previous step, we can delete them.
Remove-Item E:\drivers, E:\wim, E:\iso -Recurse
That’s it. Now you can use the custom image to create an USB boot device to install Windows with the additional drivers.