feat: Clean up driver source and obsolete config

Automatically deletes the source driver folder after successful compression into a WIM file to conserve disk space. A failure to delete will only log a warning and not interrupt the process.

Removes unused 'Make' and 'Model' properties from the UI configuration.
This commit is contained in:
rbalsleyMSFT
2025-06-26 18:12:35 -07:00
parent 98c5946efd
commit 9bbb40ce8c
2 changed files with 25 additions and 13 deletions
@@ -61,6 +61,18 @@ function Compress-DriverFolderToWim {
Invoke-Process -FilePath "dism.exe" -ArgumentList $dismArgs -Wait $true
WriteLog "Successfully compressed '$SourceFolderPath' to '$DestinationWimPath' using dism.exe."
# Remove the source folder after successful compression
WriteLog "Removing source driver folder: $SourceFolderPath"
try {
Remove-Item -Path $SourceFolderPath -Recurse -Force -ErrorAction Stop
WriteLog "Successfully removed source folder '$SourceFolderPath'."
}
catch {
WriteLog "Warning: Failed to remove source folder '$SourceFolderPath'. Error: $($_.Exception.Message)"
# Do not fail the whole operation, just log a warning.
}
return $true # Indicate success
}
catch {