How to Create USB Installation Media and Inject Drivers for Your Device
- Fredrik
- Jan 22
- 5 min read
Updated: Feb 21
I recently found a good deal on a Microsoft Surface Laptop 7th Edition and I was curious to test the ARM experience, so i went for it. The laptop was preinstalled with Windows 11 Home and a little bit of bloatware, so I decided to reinstall the laptop with a clean copy of Windows 11 Pro, and also add the device into Microsoft Intune for device management.
The Windows 11 media i used did not contain any drivers for the laptop keyboard or touchpad so i was unable to navigate the installer. You could of course just attach an external keyboard but that would have been a little too easy.
In this guide we will demonstrate how to create a FAT32 bootable partition that will work with any UEFI system (basically any modern laptop or desktop) but also fixe the 4GB limitation that is an issue with FAT32. Additionally we will demonstrate how to inject drivers into our image if needed. To follow you will need the following:
Windows ISO file
USB drive (preferably 16GB or larger but 8GB+ should suffice)
Command Prompt with elevated rights.
Any driver files (see below)

Contents
How do USB Creation Tools like Rufus work?
There are a bunch of tools out there that make bootable media a walk in the park but doing this manually and understanding what is going on behind the scenes is not really that hard. First we will explain how Rufus works
USB creation tools like Rufus work by preparing a bootable USB drive in a way that matches both firmware requirements and the limitations of common file systems. Traditionally a FAT32 partition is required for UEFI booting, but FAT32 partitions cannot store files larger than 4 GB. This is an issue for modern installation images such as Windows ISO files. To work around this tools like Rufus often create a small FAT32 partition that contains the UEFI bootloader along with an NTFS driver. When the system boots from this FAT32 partition, the driver loads and enables the firmware to read from a second larger NTFS partition where the main installation files are stored. Some newer UEFI firmware include native NTFS support, which removes the need for this workaround and allows a single NTFS-formatted partition to boot directly. However, because NTFS support is not guaranteed across all systems, tools like Rufus implement this dual-partition approach to ensure broad compatibility.
In the next section, we’ll prepare the USB using standard Windows tools (no third-party apps needed). Then we’ll explain how to add drivers into the image files.
Creating a UEFI bootable USB Drive
Open a Command Prompt as an administrator and type diskpart. In my example the USB drive that will be used to create my bootable installation media is drive 1. Check and substitute with the correct drive number by typing list disk within the diskpart utility before executing any other commands.
select disk 1
clean
convert gpt
create partition primary size=16384
select partition 1
format fs=fat32 quick label=Windows11
assign
exitTIP: If you wanted to run these commands a bit quicker or as a part of an automation you could write the commands in a text file then type diskpart /s filename.txt. This would execute the commands one by one.
We now have a USB drive with a single 16GB FAT32 partition. Before we put any content on the USB Drive we should add any device drivers to our installation media.
Adding Any Required Drivers
On some systems, hardware such as the keyboard, touchpad, or disk controller may not work…because the installation media does not contain the required device drivers. We can fix this by injecting those drivers into our installation media.
If your device is missing drivers during the installation then the boot.wim is the file to work with. If device drivers are missing after the installation has been completed we need to inject drivers into install.wim. So depending on your hardware and needs, you might need to update only one file or both. If only have .swm or .esd file look in the troubleshooting section below to convert it to a .wim file.
Create an empty folder called C:\Mount
Create another empty folder called C:\Windows11Media
Create a third empty folder called C:\Drivers
Extract or Mount your Windows 11 ISO and copy all the files to our working directory C:\Windows11Media.
First we will look at the boot.wim file to make sure we have the required drivers to install the operating system. The steps to inject drivers into the install.wim file will be almost the same but we will cover that later.
First we need to check what our image (boot.wim) contains and get the index number of the image we want to work with. Issue the following command: DISM /Get-WimInfo /WimFile:C:\Windows11Media\sources\boot.wim

As we can see in the screenshot above there are two images in the boot.wim file. The one we need to install drivers to is index 2 called "Microsoft Windows Setup".
With the correct index number we can now mount the image by running the following command: DISM /Mount-Wim /WimFile:C:\Windows11Media\sources\boot.wim /Index:2 /MountDir:C:\Mount
Next we need to get all the required drivers for our device. Bellow are some links to drivers from different vendors. Microsoft Surface
HP Dell Lenovo Many of these driver packs contain drivers for more than one specific model, you can inject all the drivers in a pack but best practice is to stick with chipset, disk controllers, network and other essential drivers to install the operating system and only the ones you specifically require. Microsoft have put all their drivers into an MSI that can be extracted by running the following command from an elevated command line: msiexec /a SurfaceMSIFile.msi /qb TARGETDIR=C:\Drivers
Once all the required files are downloaded place them inside the C:\Drivers folder
Next we will inject the all the drivers in the C:\Drivers folder into our image by issuing the following command: DISM /Image:C:\Mount /Add-Driver /Driver:C:\Drivers /Recurse

Once the drivers have been added to the image, we can unmount and save our changes. DISM /Unmount-Wim /MountDir:C:\Mount /Commit

We now have updated our boot.wim to include device specific drivers.
Next we will have a look at the install.wim file. One key difference is that the install.wim usually has one index for each edition of Windows available, but you only need to inject drivers into the index matching the edition you intend to install. Repeat steps 1-5 for the install.wim (if only have .swm or .esd look in the troubleshooting sectiont to convert it to .wim first). In the last section we split the install.wim file into multiple parts and copy the contents to our USB drive.

Solving the "file is too large for destination" issue
As mentioned in the start of the article, one of the problems with FAT32 is that files cannot be larger than 4GB. A normal install.wim file is usually 6-7GB++ in size so we need to split this file into smaller parts. DISM /Split-Image /ImageFile:C:\Windows11Media\sources\install.wim /SWMFile:C:\Windows11Media\sources\install.swm /FileSize:3800 You should now have an install.swm, install2.swm etc... depending on how big the install.wim file was. You can now safely delete the install.wim and copy all the contents of C:\Windows11Media onto the USB Drive. The drive should be bootable for all UEFI based devices.
Troubleshooting
Some Microsoft ISOs only contain install.esd or install.swm. If this is the case use the following command to convert the install.esd or install.swm file into an install.wim file that we can work with: DISM /Export-Image /SourceImageFile:C:\Windows11Media\sources\install.esd /SourceIndex:6 /DestinationImageFile:C:\Windows11Media\sources\install.wim /Compress:max /CheckIntegrity
Check what images are mounted: DISM /Get-MountedWimInfo
If any images are mounted try running: DISM /Cleanup-Wim
Discard any changes made to mounted images and try again after a reboot: DISM /Unmount-Wim /MountDir:C:\Mount /Discard
Most other issues related to DISM are due to file locks:
Start by rebooting your computer if you have any issues (yes really - reboots are the best way to solve file locks)
Exclude the folders we are using temporarily for antivirus software.
Do not browse the mount folder in explorer



Comments