Windows Installer Missing Drivers
If a stock Windows installer can't see your disk, keyboard, or network, you can build one with exactly the drivers it lacks taken from the Windows already running on that PC, using built-in tools: PowerShell and its DISM cmdlets, nothing third-party.
On my Lenovo Yoga Slim 7x (Snapdragon X Elite) with a Windows 11 Arm64 ISO, that's 9 Qualcomm platform drivers for the setup image, and the same 9 plus Wi-Fi for the Windows image.
Why the stock installer fails
The disk driver on mine was fine; the problem was underneath it. On the Slim 7x, the NVMe SSD uses the inbox stornvme driver, but its PCIe port won't come up without Qualcomm's power and PCIe platform drivers, which the installer lacks, or covers only with genpass (a placeholder that starts a device without configuring it).
Setup's Load driver dialog and the $WinPEDriver$ folder didn't help. Both add drivers after setup has booted, and boot-start platform drivers can't be added to a running system: on the Slim 7x both crashed with 0x14E SOC_CRITICAL_DEVICE_REMOVED. The drivers have to be in both images before boot.
What you need
- The PC itself, running Windows with all its hardware working. Its drivers are the source.
- A Windows ISO for that PC's architecture (x64 or Arm64), from Microsoft, no older than the Windows it's running.
- A USB drive of 10 GB or more. It will be erased.
- Maybe 20 GB free on the system for the work folder.
- One admin Windows PowerShell window for all steps. Open it from the Start menu (right-click
Start, then clickTerminal (Admin)).
Steps
Run everything in that one window; later steps use variables from earlier ones. This writes large files once to the PC's disk and once to the USB drive, which comes last.
1. Set up a work folder and mount the ISO
These snippets have the work folder directly in your user profile. $isoName is the ISO I tested with; change it to yours if using a later build. The $isoFile line assumes the ISO is in your Downloads folder.
$work = "$env:USERPROFILE\AddRequiredDriversToInstallMedia"
New-Item -ItemType Directory "$work\boot", "$work\install"
$isoName = 'Windows11_Client_arm64_en-us_26300_9457.iso'
$isoFile = Join-Path (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path $isoName
$isoDrive = (Mount-DiskImage -ImagePath $isoFile -PassThru | Get-Volume).DriveLetter + ':'
2. Copy the setup image and export your edition
Copy boot.wim as is, then make it writable. From the Windows image, export only the edition this PC runs so drivers go into one edition instead of all of them, which would take a lot more time.
Copy-Item "$isoDrive\sources\boot.wim" $work
Set-ItemProperty "$work\boot.wim" -Name IsReadOnly -Value $false
Find the edition this PC runs. The last line shows which image matched; check it before exporting.
$isoInstall = (Get-Item "$isoDrive\sources\install.*").FullName
$edition = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').EditionID
$allImages = Get-WindowsImage -ImagePath $isoInstall |
ForEach-Object { Get-WindowsImage -ImagePath $isoInstall -Index $_.ImageIndex }
$editionImage = $allImages | Where-Object EditionId -eq $edition
$editionImage | Select-Object ImageIndex, ImageName, EditionId
Then export just that image:
Export-WindowsImage -SourceImagePath $isoInstall `
-SourceIndex $editionImage.ImageIndex `
-DestinationImagePath "$work\install.wim"
3. Mount both images
Image 2 of boot.wim is the one setup runs.
Mount-WindowsImage -ImagePath "$work\boot.wim" -Index 2 -Path "$work\boot"
Mount-WindowsImage -ImagePath "$work\install.wim" -Index 1 -Path "$work\install"
Each mount prints Online : False and RestartNeeded : False. That's fine: "online" is DISM's word for the running Windows, and these are offline copies.
4. Find the missing drivers
Five small functions do this, each building on the ones before. Paste each, then run the line under it to see what it does on your PC. The section at the end, How the drivers are chosen, explains why these drivers.
4a. Read a device's properties
Get-DeviceProperties reads what Find-MissingDrivers (4e) needs about one device: its name, parent, ACPI _DEP providers (devices it depends on, which Device Manager doesn't show), and its driver's INF. The walk covers the same devices for both images, so it remembers what it has read.
function Get-DeviceProperties {
# One of this PC's devices: its name, parent, ACPI _DEP providers and the INF it uses. Read once, remembered.
param([Parameter(Mandatory)][string]$InstanceId)
if (-not $script:propertiesOf) { $script:propertiesOf = @{} }
if (-not $script:propertiesOf.ContainsKey($InstanceId)) {
$properties = @{}
Get-PnpDeviceProperty -InstanceId $InstanceId -KeyName DEVPKEY_NAME, DEVPKEY_Device_Parent, DEVPKEY_Device_DependencyProviders, DEVPKEY_Device_DriverInfPath |
ForEach-Object { $properties[$_.KeyName] = $_.Data }
$script:propertiesOf[$InstanceId] = $properties
}
$script:propertiesOf[$InstanceId]
}
Try it on the disk Windows is installed on:
$disk = Get-Disk | Where-Object IsBoot
$diskDevice = (Get-CimInstance Win32_DiskDrive -Filter "Index=$($disk.Number)").PNPDeviceID
Get-DeviceProperties $diskDevice
Any device works: its ID is the Device instance path on the Details tab of its properties in Device Manager.
4b. Find where setup needs hardware
Get-StartDevices lists where Find-MissingDrivers starts: the disk Windows is installed on, and every keyboard and mouse except the ones Windows' button converter makes from volume and power buttons. -Network adds the network adapters, which the installed Windows needs for Windows Update.
function Get-StartDevices {
# Where setup needs hardware: the disk Windows is installed on, and the keyboards and mice (not the
# ones Windows' button converter makes from volume and power buttons). -Network adds the network adapters.
param([switch]$Network)
$disk = Get-Disk | Where-Object IsBoot
(Get-CimInstance Win32_DiskDrive -Filter "Index=$($disk.Number)").PNPDeviceID
(Get-PnpDevice -Class Keyboard, Mouse -PresentOnly | Where-Object InstanceId -notlike 'HID\CONVERTEDDEVICE*').InstanceId
if ($Network) { (Get-NetAdapter -Physical).PnPDeviceID | Select-Object -Unique } # one device can have several interfaces
}
Try it:
Get-StartDevices -Network | ForEach-Object { (Get-DeviceProperties $_).DEVPKEY_NAME }
4c. Find every device a driver drives
Get-DevicesUsing lists every device on this PC that uses a given INF. When Find-MissingDrivers adds a driver, it follows these too, since that driver will drive them in the installer as well.
function Get-DevicesUsing {
# Every device on this PC that uses a given INF.
param([Parameter(Mandatory)][string]$Inf)
if (-not $script:signedDrivers) { $script:signedDrivers = Get-CimInstance Win32_PnPSignedDriver }
($script:signedDrivers | Where-Object InfName -eq $Inf).DeviceID
}
Try it. It lists every disk, including a USB drive if one is plugged in:
Get-DevicesUsing disk.inf | ForEach-Object { (Get-DeviceProperties $_).DEVPKEY_NAME }
4d. Find a driver package in the driver store
Windows installs each non-inbox driver under a name like oem12.inf. Get-PackageFolder returns that package's folder in this PC's driver store, which is what Add-WindowsDriver takes in step 5.
function Get-PackageFolder {
# Where a non-inbox driver (oemNN.inf) lives in this PC's driver store.
param([Parameter(Mandatory)][string]$Inf)
if (-not $script:installedDrivers) { $script:installedDrivers = Get-WindowsDriver -Online }
$driver = $script:installedDrivers | Where-Object Driver -eq $Inf
if ($driver) { Split-Path $driver.OriginalFileName }
}
Try it on the first non-inbox driver installed on this PC. If oem0.inf isn't there, pnputil /enum-drivers will list the ones that are.
Get-PackageFolder oem0.inf
4e. Find the missing drivers
Find-MissingDrivers starts from 4b's devices and follows each one's parent and _DEP providers. For a device whose driver isn't part of Windows, it adds this PC's package and follows every other device that package drives (4c). A device using a driver from Windows needs nothing, as long as the image has that INF too.
function Find-MissingDrivers {
# The driver packages a mounted image needs from this PC: for every device setup needs, the driver this
# PC uses for it, unless that driver is part of Windows itself.
param([Parameter(Mandatory)][string]$Image, [switch]$Network)
$seen = @{}; $added = @{}
$todo = [Collections.Generic.Queue[string]]::new([string[]](Get-StartDevices -Network:$Network | Where-Object { $_ }))
while ($todo.Count) {
$id = $todo.Dequeue()
if ($seen[$id]) { continue }
$seen[$id] = $true
$device = Get-DeviceProperties $id
$next = @($device.DEVPKEY_Device_Parent) + @($device.DEVPKEY_Device_DependencyProviders)
$inf = $device.DEVPKEY_Device_DriverInfPath
if ($inf -like 'oem*') {
# Not part of Windows: add this PC's package, and follow every other device it drives
if (-not $added[$inf]) {
$added[$inf] = $true
$folder = Get-PackageFolder $inf
if ($folder) {
[pscustomobject]@{ Image = $Image; Package = Split-Path $folder -Leaf; Folder = $folder }
} else {
Write-Warning "No driver store folder found for $inf, which this PC uses for $($device.DEVPKEY_NAME)"
}
$next += Get-DevicesUsing $inf
}
} elseif ($inf -and -not (Test-Path "$Image\Windows\INF\$inf")) {
# Part of Windows, but missing from this image
Write-Warning "$Image lacks $inf, which this PC uses for $($device.DEVPKEY_NAME)"
}
$next | Where-Object { $_ } | ForEach-Object { $todo.Enqueue($_) }
}
}
Run it for each image. Only the installed Windows gets the network adapters:
$missing = @(Find-MissingDrivers -Image "$work\boot") +
@(Find-MissingDrivers -Image "$work\install" -Network)
$missing | Format-Table Image, Package
On the Slim 7x this lists 9 packages for boot and 10 for install, with no warnings, in about 20 seconds. Everything else (audio, camera, GPU) should come from Windows Update after installation.
5. Add the drivers and save both images
$missing | ForEach-Object { Add-WindowsDriver -Path $_.Image -Driver $_.Folder }
Dismount-WindowsImage -Path "$work\boot" -Save
Dismount-WindowsImage -Path "$work\install" -Save
6. Write the USB drive
Find the USB drive's disk number, and check it twice: the next command erases it. Pasting this lists the USB disks and leaves $stickDisk = waiting for you to type the drive's Number.
Get-Disk | Where-Object BusType -eq USB
$stickDisk =
UEFI boots from FAT32, so the drive is FAT32, and the steps below split install.wim under the 4 GB file limit (-FileSize is in MB). The finished drive holds about 8 GB.
Erase it. Clear-Disk asks you to confirm.
Clear-Disk -Number $stickDisk -RemoveData -RemoveOEM
Then make it GPT, add a partition, and format it.
Set-Disk -Number $stickDisk -PartitionStyle GPT
$stickDrive = (New-Partition -DiskNumber $stickDisk -UseMaximumSize -AssignDriveLetter |
Format-Volume -FileSystem FAT32 -NewFileSystemLabel WINSETUP).DriveLetter + ':'
Then copy the ISO's files (except its two images), the new setup image, and the Windows image in pieces. This takes several minutes, and only robocopy shows progress; Copy-Item and Split-WindowsImage print nothing until they're done.
robocopy "$isoDrive\" "$stickDrive\" /E /XF boot.wim install.wim install.esd
Copy-Item "$work\boot.wim" "$stickDrive\sources"
Split-WindowsImage -ImagePath "$work\install.wim" `
-SplitImagePath "$stickDrive\sources\install.swm" -FileSize 4000
robocopy's summary should show FAILED as 0 in every row.
Optionally, back up every driver this PC has that isn't part of Windows (139 packages, 1.3 GB here). It's slow, but if Windows Update can't find one later, it's on the drive.
Export-WindowsDriver -Online -Destination "$stickDrive\Drivers"
Then eject the drive. This does what Eject in Explorer does: it flushes the drive's cache and stops it, so you can unplug it.
(New-Object -ComObject Shell.Application).NameSpace(17).ParseName("$stickDrive\").InvokeVerb('Eject')
7. Clean up
Dismount-DiskImage -ImagePath $isoFile
Remove-Item $work -Recurse
How the drivers are chosen
The running PC is the reference: the installer gets the drivers the PC uses for every device setup needs, except ones that are part of Windows.
- Start where setup needs hardware: the disk Windows is installed on, and every keyboard and mouse, skipping the ones Windows' button converter makes from volume and power buttons. The Windows image also gets the physical network adapters, so it can reach Windows Update.
- Follow what each device needs: its parent and its ACPI
_DEPproviders, which Device Manager doesn't show. - Add the PC's own driver for every device whose driver isn't part of Windows, and follow every other device that driver drives, because it will drive them in the installer too.
- Skip devices that use a driver from Windows, as long as the image has the same INF.
Why not trust a driver the image already has? The setup image has its own, older GPIO driver (qcgpio_i) that matches the GPIO device, but an installer using it instead of the PC's qcgpio8380 still couldn't see the disk. Only booting proves a different driver works, while the PC already proves its own, so only the same driver counts.
On the Slim 7x, rule 3 is why there are 9 drivers rather than 4. The disk needs qcpep, qcppx, qcipcc, and qcgpio, but qcpep also drives 18 thermal and policy devices, and those need the PMIC, SPMI, ADC, and I2C drivers.
| Package | Why it's needed |
|---|---|
qcpep.wd8380 | The PCIe root complex depends on the Power Engine Plug-in |
qcppx8380 | The PCIe root complex depends on the PCIe platform extension |
qcgpio8380 | The PCIe root port depends on the GPIO controller; the image's older qcgpio_i isn't enough |
qcipcc8380 | qcpep uses the inter-processor interrupts |
qci2c8380 | The keyboard, touchpad, and some of qcpep's devices sit on I2C buses |
qcpmic8380 | qcpep's thermal devices need the power-management chip |
qcspmi8380 | The power-management chip sits on this bus |
qcpmicgpio8380 | One thermal device needs the power-management chip's GPIO |
qcadc8380 | The temperature monitors read through the ADC |
qcwlanhmt8380 | The Wi-Fi adapter needs it (Windows image only) |