From 43223ad1ccea479aad5ecd1590f36a74e52f9d49 Mon Sep 17 00:00:00 2001
From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com>
Date: Wed, 28 May 2025 17:43:59 -0700
Subject: [PATCH] Add 'Remove Apps Folder Content' checkbox to UI and update
related logic
- Introduced a new checkbox in the UI for removing application content in the Apps folder after FFU capture.
- Updated the Get-UIConfig function to retrieve the state of the new checkbox.
- Added default value for the new 'RemoveApps' parameter in the general defaults.
---
FFUDevelopment/BuildFFUVM_UI.ps1 | 5 ++++-
FFUDevelopment/BuildFFUVM_UI.xaml | 1 +
FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1 | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/FFUDevelopment/BuildFFUVM_UI.ps1 b/FFUDevelopment/BuildFFUVM_UI.ps1
index 684bdfe..ad9caec 100644
--- a/FFUDevelopment/BuildFFUVM_UI.ps1
+++ b/FFUDevelopment/BuildFFUVM_UI.ps1
@@ -648,7 +648,7 @@ function Get-UIConfig {
Processors = [int]$window.FindName('txtProcessors').Text
ProductKey = $window.FindName('txtProductKey').Text
PromptExternalHardDiskMedia = $window.FindName('chkPromptExternalHardDiskMedia').IsChecked
- RemoveApps = $false # Parameter from Sample_default.json, no UI control
+ RemoveApps = $window.FindName('chkRemoveApps').IsChecked
RemoveFFU = $window.FindName('chkRemoveFFU').IsChecked
RemoveUpdates = $false # Parameter from Sample_default.json, no UI control
ShareName = $window.FindName('txtShareName').Text
@@ -1601,6 +1601,7 @@ $window.Add_Loaded({
$script:chkInstallDrivers = $window.FindName('chkInstallDrivers')
$script:chkCopyDrivers = $window.FindName('chkCopyDrivers')
$script:chkCompressDriversToWIM = $window.FindName('chkCompressDriversToWIM')
+ $script:chkRemoveApps = $window.FindName('chkRemoveApps')
# AppsScriptVariables Controls
$script:chkDefineAppsScriptVariables = $window.FindName('chkDefineAppsScriptVariables')
@@ -1726,6 +1727,7 @@ $window.Add_Loaded({
$window.FindName('chkCleanupDeployISO').IsChecked = $script:generalDefaults.CleanupDeployISO
$window.FindName('chkCleanupDrivers').IsChecked = $script:generalDefaults.CleanupDrivers
$window.FindName('chkRemoveFFU').IsChecked = $script:generalDefaults.RemoveFFU
+ $script:chkRemoveApps.IsChecked = $script:generalDefaults.RemoveApps # New
# Hyper-V Settings defaults from General Defaults
$window.FindName('txtDiskSize').Text = $script:generalDefaults.DiskSizeGB
@@ -3023,6 +3025,7 @@ $btnLoadConfig.Add_Click({
Set-UIValue -ControlName 'chkCleanupDeployISO' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'CleanupDeployISO' -WindowInstance $window
Set-UIValue -ControlName 'chkCleanupDrivers' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'CleanupDrivers' -WindowInstance $window
Set-UIValue -ControlName 'chkRemoveFFU' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'RemoveFFU' -WindowInstance $window
+ Set-UIValue -ControlName 'chkRemoveApps' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'RemoveApps' -WindowInstance $window # New
# Hyper-V Settings
Set-UIValue -ControlName 'cmbVMSwitchName' -PropertyName 'SelectedItem' -ConfigObject $configContent -ConfigKey 'VMSwitchName' -WindowInstance $window
diff --git a/FFUDevelopment/BuildFFUVM_UI.xaml b/FFUDevelopment/BuildFFUVM_UI.xaml
index b737d73..0deb1c6 100644
--- a/FFUDevelopment/BuildFFUVM_UI.xaml
+++ b/FFUDevelopment/BuildFFUVM_UI.xaml
@@ -235,6 +235,7 @@
+
diff --git a/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1 b/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1
index 02826b8..5b2f65d 100644
--- a/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1
+++ b/FFUDevelopment/FFUUI.Core/FFUUI.Core.psm1
@@ -292,6 +292,7 @@ function Get-GeneralDefaults {
CleanupDeployISO = $false
CleanupDrivers = $false
RemoveFFU = $false
+ RemoveApps = $false # New
# Hyper-V Settings Defaults
VMHostIPAddress = "" # Requires user input
DiskSizeGB = 30