From f9a8e3149fcd205c0f188d92f261f3bbe6a8e2cb Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Wed, 9 Jul 2025 09:50:26 -0700 Subject: [PATCH] Adds a "Verbose" checkbox to the UI, allowing users to enable write-verbose output from the underlying build script. This helps in troubleshooting the FFU build process by providing more detailed output to the console. The verbose setting is saved to and loaded from the configuration file. --- FFUDevelopment/BuildFFUVM_UI.ps1 | 12 +++++++++++- FFUDevelopment/BuildFFUVM_UI.xaml | 1 + FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 | 2 ++ FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 | 3 +++ FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1 | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/FFUDevelopment/BuildFFUVM_UI.ps1 b/FFUDevelopment/BuildFFUVM_UI.ps1 index 03950df..4527b96 100644 --- a/FFUDevelopment/BuildFFUVM_UI.ps1 +++ b/FFUDevelopment/BuildFFUVM_UI.ps1 @@ -121,7 +121,17 @@ $btnRun.Add_Click({ $txtStatus.Text = "Office Configuration XML file copied successfully." } $txtStatus.Text = "Executing BuildFFUVM script with config file..." - & "$PSScriptRoot\BuildFFUVM.ps1" -ConfigFile $configFilePath + + # Prepare parameters for splatting + $buildParams = @{ + ConfigFile = $configFilePath + } + if ($config.Verbose) { + $buildParams['Verbose'] = $true + } + + & "$PSScriptRoot\BuildFFUVM.ps1" @buildParams + $txtStatus.Text = "FFU build completed successfully." } catch { diff --git a/FFUDevelopment/BuildFFUVM_UI.xaml b/FFUDevelopment/BuildFFUVM_UI.xaml index 626c140..d83332d 100644 --- a/FFUDevelopment/BuildFFUVM_UI.xaml +++ b/FFUDevelopment/BuildFFUVM_UI.xaml @@ -175,6 +175,7 @@ + diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 index 826a06c..724a5d6 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Config.psm1 @@ -89,6 +89,7 @@ function Get-UIConfig { UserAppListPath = "$($State.Controls.txtApplicationPath.Text)\UserAppList.json" USBDriveList = @{} Username = $State.Controls.txtUsername.Text + Verbose = $State.Controls.chkVerbose.IsChecked VMHostIPAddress = $State.Controls.txtVMHostIPAddress.Text VMLocation = $State.Controls.txtVMLocation.Text VMSwitchName = if ($State.Controls.cmbVMSwitchName.SelectedItem -eq 'Other') { @@ -280,6 +281,7 @@ function Update-UIFromConfig { Set-UIValue -ControlName 'chkPromptExternalHardDiskMedia' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'PromptExternalHardDiskMedia' -State $State Set-UIValue -ControlName 'chkCreateCaptureMedia' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'CreateCaptureMedia' -State $State Set-UIValue -ControlName 'chkCreateDeploymentMedia' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'CreateDeploymentMedia' -State $State + Set-UIValue -ControlName 'chkVerbose' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'Verbose' -State $State # USB Drive Modification group (Build Tab) Set-UIValue -ControlName 'chkCopyAutopilot' -PropertyName 'IsChecked' -ConfigObject $ConfigContent -ConfigKey 'CopyAutopilot' -State $State diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 index 50d66e5..6e6ea19 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.Initialize.psm1 @@ -98,6 +98,7 @@ function Initialize-UIControls { $State.Controls.chkAllowVHDXCaching = $window.FindName('chkAllowVHDXCaching') $State.Controls.chkCreateCaptureMedia = $window.FindName('chkCreateCaptureMedia') $State.Controls.chkCreateDeploymentMedia = $window.FindName('chkCreateDeploymentMedia') + $State.Controls.chkVerbose = $window.FindName('chkVerbose') $State.Controls.chkCopyAutopilot = $window.FindName('chkCopyAutopilot') $State.Controls.chkCopyUnattend = $window.FindName('chkCopyUnattend') $State.Controls.chkCopyPPKG = $window.FindName('chkCopyPPKG') @@ -146,6 +147,7 @@ function Initialize-UIControls { $State.Controls.chkUpdateADK = $window.FindName('chkUpdateADK') $State.Controls.btnLoadConfig = $window.FindName('btnLoadConfig') $State.Controls.btnBuildConfig = $window.FindName('btnBuildConfig') + } function Initialize-VMSwitchData { @@ -213,6 +215,7 @@ function Initialize-UIDefaults { $State.Controls.chkRemoveFFU.IsChecked = $State.Defaults.generalDefaults.RemoveFFU $State.Controls.chkRemoveApps.IsChecked = $State.Defaults.generalDefaults.RemoveApps $State.Controls.chkRemoveUpdates.IsChecked = $State.Defaults.generalDefaults.RemoveUpdates + $State.Controls.chkVerbose.IsChecked = $State.Defaults.generalDefaults.Verbose $State.Controls.usbSection.Visibility = if ($State.Controls.chkBuildUSBDriveEnable.IsChecked) { 'Visible' } else { 'Collapsed' } $State.Controls.usbSelectionPanel.Visibility = if ($State.Controls.chkSelectSpecificUSBDrives.IsChecked) { 'Visible' } else { 'Collapsed' } $State.Controls.chkSelectSpecificUSBDrives.IsEnabled = $State.Controls.chkBuildUSBDriveEnable.IsChecked diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1 index 284ba3d..48eef85 100644 --- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1 +++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1 @@ -118,6 +118,7 @@ function Get-GeneralDefaults { AllowVHDXCaching = $false CreateCaptureMedia = $true CreateDeploymentMedia = $true + Verbose = $false AllowExternalHardDiskMedia = $false PromptExternalHardDiskMedia = $true SelectSpecificUSBDrives = $false