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.
This commit is contained in:
rbalsleyMSFT
2025-05-28 17:43:59 -07:00
parent f6c8172676
commit 43223ad1cc
3 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -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
+1
View File
@@ -235,6 +235,7 @@
<CheckBox x:Name="chkCleanupDeployISO" Content="Cleanup Deploy ISO" Margin="5" VerticalAlignment="Center" Tag="Remove WinPE deployment ISO after FFU capture."/>
<CheckBox x:Name="chkCleanupDrivers" Content="Cleanup Drivers" Margin="5" VerticalAlignment="Center" Tag="Remove drivers folder after FFU capture."/>
<CheckBox x:Name="chkRemoveFFU" Content="Remove FFU" Margin="5" VerticalAlignment="Center" Tag="Remove FFU after copying to USB drive."/>
<CheckBox x:Name="chkRemoveApps" Content="Remove Apps Folder Content" Margin="5" VerticalAlignment="Center" Tag="When set to $true, will remove the application content in the Apps folder after the FFU has been captured."/>
</StackPanel>
</Grid>
</ScrollViewer>
@@ -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