Adds UI/CLI to copy additional FFUs to USB build

- Enables selecting multiple existing FFU images to include on the deployment USB for easier distribution and testing.
- Adds a UI option with selectable, sortable list from the capture folder, refresh support, and persisted selections.
- Validates that selections exist when the option is enabled to prevent empty runs.
- Supports unattended/CLI flows by prompting early or accepting a preselected list for USB creation; deduplicates and logs chosen files.
- Always includes the just-built (or latest available) FFU as a base.
- Improves no-FFU handling and streamlines multi-FFU selection workflow.
This commit is contained in:
rbalsleyMSFT
2025-09-18 18:17:58 -07:00
parent d9c0c9c68e
commit 15a5b16b39
7 changed files with 367 additions and 44 deletions
+60
View File
@@ -128,6 +128,7 @@ function Get-GeneralDefaults {
AllowExternalHardDiskMedia = $false
PromptExternalHardDiskMedia = $true
SelectSpecificUSBDrives = $false
CopyAdditionalFFUFiles = $false
CopyAutopilot = $false
CopyUnattend = $false
CopyPPKG = $false
@@ -198,6 +199,65 @@ function Get-USBDrives {
}
}
# Returns a list of FFU files from the provided folder with selection metadata
function Get-FFUFiles {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$Path
)
if (-not (Test-Path -Path $Path)) {
return @()
}
Get-ChildItem -Path $Path -Filter '*.ffu' -File -ErrorAction SilentlyContinue | ForEach-Object {
[PSCustomObject]@{
IsSelected = $false
Name = $_.Name
LastModified = $_.LastWriteTime
FullName = $_.FullName
}
}
}
# Helper: Populate Additional FFU List from the capture folder
function Update-AdditionalFFUList {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[PSCustomObject]$State
)
try {
$ffuFolder = $State.Controls.txtFFUCaptureLocation.Text
$listView = $State.Controls.lstAdditionalFFUs
if ($null -eq $listView) { return }
$listView.Items.Clear()
if ([string]::IsNullOrWhiteSpace($ffuFolder) -or -not (Test-Path -Path $ffuFolder)) {
WriteLog "Additional FFUs: Capture folder not set or not found: $ffuFolder"
}
else {
$items = Get-ChildItem -Path $ffuFolder -Filter '*.ffu' -File -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending |
ForEach-Object {
[PSCustomObject]@{
IsSelected = $false
Name = $_.Name
LastModified = $_.LastWriteTime
FullName = $_.FullName
}
}
foreach ($it in $items) { $listView.Items.Add($it) | Out-Null }
WriteLog "Additional FFUs: Found $($listView.Items.Count) FFU files in $ffuFolder."
}
$headerChk = $State.Controls.chkSelectAllAdditionalFFUs
if ($null -ne $headerChk) {
Update-SelectAllHeaderCheckBoxState -ListView $listView -HeaderCheckBox $headerChk
}
}
catch {
WriteLog "Update-AdditionalFFUList error: $($_.Exception.Message)"
}
}
# Function to manage the visibility of the application UI panels
function Update-ApplicationPanelVisibility {
param(