From 60cf1dab18f6a2a50b58810d27e14461440ce6da Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Fri, 24 Oct 2025 22:28:44 -0700 Subject: [PATCH] Enhances progress status messages in driver download and extraction functions for Dell, HP, Lenovo, and Microsoft drivers. Updates messages to include driver names and versions for better clarity during operations. --- FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Dell.psm1 | 7 ++++++- FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.HP.psm1 | 4 +++- .../FFUUI.Core/FFUUI.Core.Drivers.Lenovo.psm1 | 6 +++--- .../FFUUI.Core/FFUUI.Core.Drivers.Microsoft.psm1 | 10 +++++----- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Dell.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Dell.psm1 index 1e5bfb0..1ddedea 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Dell.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Dell.psm1 @@ -273,7 +273,9 @@ function Save-DellDriversTask { $idx = 0 foreach ($pkg in $packages) { $idx++ - $status = "Downloading $idx/$total" + $driverName = $pkg.Name + if ([string]::IsNullOrWhiteSpace($driverName)) { $driverName = $pkg.DriverFileName } + $status = "$idx/$total Downloading $driverName" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelDisplay -Status $status } $categorySafe = ($pkg.Category -replace '[\\\/\:\*\?\"\<\>\| ]','_') @@ -294,6 +296,9 @@ function Save-DellDriversTask { catch { WriteLog "Download failed: $($pkg.DownloadUrl) $($_.Exception.Message)"; continue } } + $status = "$idx/$total Extracting $driverName" + if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelDisplay -Status $status } + if (-not (Test-Path $extractFolder)) { New-Item -Path $extractFolder -ItemType Directory -Force | Out-Null } $arg1 = "/s /e=`"$extractFolder`" /l=`"$extractFolder\log.log`"" diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.HP.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.HP.psm1 index 9708472..900dbd5 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.HP.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.HP.psm1 @@ -330,7 +330,7 @@ function Save-HPDriversTask { $extractFolder = Join-Path -Path $downloadFolder -ChildPath ($driverName + "_" + $version + "_" + ($driverFileName -replace '\.exe$', '')) $downloadedCount++ - $progressMsg = "($downloadedCount/$totalDrivers) Downloading $driverName..." + $progressMsg = "$downloadedCount/$totalDrivers Downloading $driverName" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $identifier -Status $progressMsg } WriteLog "$progressMsg URL: $driverUrl" @@ -344,6 +344,8 @@ function Save-HPDriversTask { WriteLog "Downloading driver to: $driverFilePath" Start-BitsTransferWithRetry -Source $driverUrl -Destination $driverFilePath -ErrorAction Stop WriteLog "Driver downloaded: $driverFilePath" + $progressMsg = "$downloadedCount/$totalDrivers Extracting $driverName" + if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $identifier -Status $progressMsg } WriteLog "Creating extraction folder: $extractFolder" New-Item -Path $extractFolder -ItemType Directory -Force -ErrorAction Stop | Out-Null $arguments = "/s /e /f `"$extractFolder`"" diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Lenovo.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Lenovo.psm1 index 73577b8..e0fbae4 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Lenovo.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Lenovo.psm1 @@ -278,7 +278,7 @@ function Save-LenovoDriversTask { } # Download the driver .exe - $status = "($processedPackages/$totalPackages) Downloading $packageTitle..." + $status = "$processedPackages/$totalPackages Downloading $packageTitle" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $identifier -Status $status } WriteLog "($processedPackages/$totalPackages) Downloading driver: $driverUrl to $driverFilePath" try { @@ -292,7 +292,7 @@ function Save-LenovoDriversTask { } # --- Extraction Logic --- - $status = "($processedPackages/$totalPackages) Extracting $packageTitle..." + $status = "$processedPackages/$totalPackages Extracting $packageTitle" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $identifier -Status $status } # Always use a temporary extraction path to avoid long path issues @@ -317,7 +317,7 @@ function Save-LenovoDriversTask { # Modify the extract command to point to the temporary folder $modifiedExtractCommand = $extractCommand -replace '%PACKAGEPATH%', "`"$extractFolder`"" - WriteLog "($processedPackages/$totalPackages) Extracting driver: $driverFilePath using command: $modifiedExtractCommand" + WriteLog "$processedPackages/$totalPackages Extracting driver: $driverFilePath using command: $modifiedExtractCommand" try { Invoke-Process -FilePath $driverFilePath -ArgumentList $modifiedExtractCommand -Wait $true | Out-Null diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Microsoft.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Microsoft.psm1 index 7bacb37..10897b9 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Microsoft.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Drivers.Microsoft.psm1 @@ -226,7 +226,7 @@ function Save-MicrosoftDriversTask { ### DOWNLOAD AND EXTRACT if ($downloadLink) { WriteLog "Selected Download Link for $modelName (Actual: Windows $downloadedVersion): $downloadLink" - $status = "Downloading (Win$downloadedVersion)..." # Update status message + $status = "Downloading Win$downloadedVersion $fileName" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelName -Status $status } # Create directories @@ -257,7 +257,7 @@ function Save-MicrosoftDriversTask { ### EXTRACT if ($fileExtension -eq ".msi") { - $status = "Waiting for MSI lock..." # Set initial status + $status = "Waiting for MSI lock..." if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelName -Status $status } # Use a named mutex to ensure only one MSI extraction happens at a time across all parallel tasks @@ -286,14 +286,14 @@ function Save-MicrosoftDriversTask { catch [System.Threading.WaitHandleCannotBeOpenedException] { # Mutex is clear, proceed to extraction attempt WriteLog "System MSI mutex clear. Proceeding with MSI extraction attempt for $modelName." - $status = "Extracting MSI..." + $status = "Extracting Win$downloadedVersion $fileName" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelName -Status $status } $mutexClear = $true } catch { # Handle other potential errors when checking the mutex WriteLog "Warning: Error checking system MSI mutex for $($modelName): $_. Proceeding with caution." - $status = "Extracting MSI (Mutex Error)..." + $status = "Extracting Win$downloadedVersion $fileName (Mutex Error)" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelName -Status $status } $mutexClear = $true # Proceed despite mutex error } @@ -351,7 +351,7 @@ function Save-MicrosoftDriversTask { } } elseif ($fileExtension -eq ".zip") { - $status = "Extracting ZIP..." # Set status before extraction + $status = "Extracting Win$downloadedVersion $fileName" if ($null -ne $ProgressQueue) { Invoke-ProgressUpdate -ProgressQueue $ProgressQueue -Identifier $modelName -Status $status } WriteLog "Extracting ZIP file to $modelPath" $ProgressPreference = 'SilentlyContinue'