Filter unserviceable and stale drivers before Win11 Creator injection (#5016)

* fix(win11-creator): filter unserviceable and stale drivers before injection

Add-Driver aborts the whole batch when one exported package is bad,
which broke ISO creation for anyone with an Extension-class or stale
duplicate driver in their store (#4971, #4982). Exclude both before
the single Add-Driver call instead of guessing per-vendor.

* fix(win11-creator): address driver filtering review feedback

Accept date-only DriverVer entries instead of treating them as
unknown. Use the full folder path as the dedup fallback key so two
unrelated packages can't collide on a shared leaf name. Discard the
logger's own output inside the selector so an emitting -Log callback
can't inflate the survivor count. Skip driver injection instead of
failing the whole ISO build when nothing is left to inject.

Also extracts the repeated DISM mock setup in the driver tests into
one shared harness, and asserts that excluded packages are actually
deleted from the export root before Add-Driver runs, not just logged.

* fix: address remaining code review comments
This commit is contained in:
Omar
2026-09-02 10:11:20 -05:00
committed by GitHub
parent c00f1eb7b3
commit 22e1dc9b09
3 changed files with 419 additions and 67 deletions
+5 -2
View File
@@ -277,11 +277,14 @@ function Invoke-WinUtilISOModify {
$selectedEditionId = Get-WinUtilEditionIdFromName -EditionName $selectedEditionName
Log "Writing autounattend.xml and edition selection..."
Invoke-WinUtilISOScript -ISOContentsDir $isoContents -AutoUnattendXml $autounattendContent -InjectCurrentSystemDrivers $injectDrivers -InstallImagePath $localWim -InstallImageIndex $selectedWimIndex -InstallEditionId $selectedEditionId -Log { param($m) Log $m }
$driversInjected = [ref]$false
Invoke-WinUtilISOScript -ISOContentsDir $isoContents -AutoUnattendXml $autounattendContent -InjectCurrentSystemDrivers $injectDrivers -InstallImagePath $localWim -InstallImageIndex $selectedWimIndex -InstallEditionId $selectedEditionId -Log { param($m) Log $m } -DriversInjected $driversInjected
SetProgress "Preserving install image..." 70
if ($injectDrivers) {
if ($driversInjected.Value) {
Log "Added current-system drivers to $sourceImageFileName index $selectedWimIndex with one mount and commit."
} elseif ($injectDrivers) {
Log "No current-system drivers needed injection into $sourceImageFileName index $selectedWimIndex; install.wim was left unchanged."
} else {
Log "Preserved the original $sourceImageFileName without mounting, exporting, or modifying it."
}