Feat: Add WIM compression for existing driver folders

Implements logic to compress previously downloaded driver folders into WIM files if the compression option is enabled. This ensures consistency in the driver store when re-running the download process.

Refactors the parallel task processing to rely on a standardized boolean 'Success' property from all driver download tasks. This simplifies the result handling logic and makes it more reliable than parsing status strings.
This commit is contained in:
rbalsleyMSFT
2025-06-28 00:51:22 -07:00
parent 0b0046986e
commit 1523091637
5 changed files with 99 additions and 12 deletions
@@ -141,14 +141,22 @@ function Save-HPDriversTask {
Compress-DriverFolderToWim -SourceFolderPath $sourceFolderPath -DestinationWimPath $wimFilePath -WimName $identifier -WimDescription "Drivers for $identifier" -ErrorAction Stop
$existingDriver.Status = "Already downloaded & Compressed"
$existingDriver.DriverPath = Join-Path -Path $make -ChildPath "$($sanitizedModelName).wim"
$existingDriver.Success = $true
WriteLog "Successfully compressed existing drivers for $identifier to $wimFilePath."
}
catch {
WriteLog "Error compressing existing drivers for $($identifier): $($_.Exception.Message)"
$existingDriver.Status = "Already downloaded (Compression failed)"
$existingDriver.Success = $false
}
if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $identifier -Status $existingDriver.Status }
}
# Ensure the Success property exists on the object being returned.
if (-not $existingDriver.PSObject.Properties.Name -contains 'Success') {
$existingDriver | Add-Member -MemberType NoteProperty -Name 'Success' -Value $true
}
return $existingDriver
}