Add 'Remove Downloaded Update Files' checkbox to UI and update related logic for handling updates

This commit is contained in:
rbalsleyMSFT
2025-05-28 18:01:59 -07:00
parent 43223ad1cc
commit 985285963c
3 changed files with 9 additions and 4 deletions
+6 -3
View File
@@ -650,7 +650,7 @@ function Get-UIConfig {
PromptExternalHardDiskMedia = $window.FindName('chkPromptExternalHardDiskMedia').IsChecked PromptExternalHardDiskMedia = $window.FindName('chkPromptExternalHardDiskMedia').IsChecked
RemoveApps = $window.FindName('chkRemoveApps').IsChecked RemoveApps = $window.FindName('chkRemoveApps').IsChecked
RemoveFFU = $window.FindName('chkRemoveFFU').IsChecked RemoveFFU = $window.FindName('chkRemoveFFU').IsChecked
RemoveUpdates = $false # Parameter from Sample_default.json, no UI control RemoveUpdates = $window.FindName('chkRemoveUpdates').IsChecked
ShareName = $window.FindName('txtShareName').Text ShareName = $window.FindName('txtShareName').Text
UpdateADK = $true # Parameter from Sample_default.json, no UI control UpdateADK = $true # Parameter from Sample_default.json, no UI control
UpdateEdge = $window.FindName('chkUpdateEdge').IsChecked UpdateEdge = $window.FindName('chkUpdateEdge').IsChecked
@@ -1602,6 +1602,7 @@ $window.Add_Loaded({
$script:chkCopyDrivers = $window.FindName('chkCopyDrivers') $script:chkCopyDrivers = $window.FindName('chkCopyDrivers')
$script:chkCompressDriversToWIM = $window.FindName('chkCompressDriversToWIM') $script:chkCompressDriversToWIM = $window.FindName('chkCompressDriversToWIM')
$script:chkRemoveApps = $window.FindName('chkRemoveApps') $script:chkRemoveApps = $window.FindName('chkRemoveApps')
$script:chkRemoveUpdates = $window.FindName('chkRemoveUpdates')
# AppsScriptVariables Controls # AppsScriptVariables Controls
$script:chkDefineAppsScriptVariables = $window.FindName('chkDefineAppsScriptVariables') $script:chkDefineAppsScriptVariables = $window.FindName('chkDefineAppsScriptVariables')
@@ -1727,7 +1728,8 @@ $window.Add_Loaded({
$window.FindName('chkCleanupDeployISO').IsChecked = $script:generalDefaults.CleanupDeployISO $window.FindName('chkCleanupDeployISO').IsChecked = $script:generalDefaults.CleanupDeployISO
$window.FindName('chkCleanupDrivers').IsChecked = $script:generalDefaults.CleanupDrivers $window.FindName('chkCleanupDrivers').IsChecked = $script:generalDefaults.CleanupDrivers
$window.FindName('chkRemoveFFU').IsChecked = $script:generalDefaults.RemoveFFU $window.FindName('chkRemoveFFU').IsChecked = $script:generalDefaults.RemoveFFU
$script:chkRemoveApps.IsChecked = $script:generalDefaults.RemoveApps # New $script:chkRemoveApps.IsChecked = $script:generalDefaults.RemoveApps
$script:chkRemoveUpdates.IsChecked = $script:generalDefaults.RemoveUpdates
# Hyper-V Settings defaults from General Defaults # Hyper-V Settings defaults from General Defaults
$window.FindName('txtDiskSize').Text = $script:generalDefaults.DiskSizeGB $window.FindName('txtDiskSize').Text = $script:generalDefaults.DiskSizeGB
@@ -3025,7 +3027,8 @@ $btnLoadConfig.Add_Click({
Set-UIValue -ControlName 'chkCleanupDeployISO' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'CleanupDeployISO' -WindowInstance $window 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 'chkCleanupDrivers' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'CleanupDrivers' -WindowInstance $window
Set-UIValue -ControlName 'chkRemoveFFU' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'RemoveFFU' -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 Set-UIValue -ControlName 'chkRemoveApps' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'RemoveApps' -WindowInstance $window
Set-UIValue -ControlName 'chkRemoveUpdates' -PropertyName 'IsChecked' -ConfigObject $configContent -ConfigKey 'RemoveUpdates' -WindowInstance $window
# Hyper-V Settings # Hyper-V Settings
Set-UIValue -ControlName 'cmbVMSwitchName' -PropertyName 'SelectedItem' -ConfigObject $configContent -ConfigKey 'VMSwitchName' -WindowInstance $window Set-UIValue -ControlName 'cmbVMSwitchName' -PropertyName 'SelectedItem' -ConfigObject $configContent -ConfigKey 'VMSwitchName' -WindowInstance $window
+1
View File
@@ -236,6 +236,7 @@
<CheckBox x:Name="chkCleanupDrivers" Content="Cleanup Drivers" Margin="5" VerticalAlignment="Center" Tag="Remove drivers folder 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="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."/> <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."/>
<CheckBox x:Name="chkRemoveUpdates" Content="Remove Downloaded Update Files" Margin="5" VerticalAlignment="Center" Tag="When set to $true, will remove downloaded CU, .NET, MSRT, Defender, Edge, and OneDrive files after being applied/included."/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</ScrollViewer> </ScrollViewer>
+2 -1
View File
@@ -292,7 +292,8 @@ function Get-GeneralDefaults {
CleanupDeployISO = $false CleanupDeployISO = $false
CleanupDrivers = $false CleanupDrivers = $false
RemoveFFU = $false RemoveFFU = $false
RemoveApps = $false # New RemoveApps = $false
RemoveUpdates = $false
# Hyper-V Settings Defaults # Hyper-V Settings Defaults
VMHostIPAddress = "" # Requires user input VMHostIPAddress = "" # Requires user input
DiskSizeGB = 30 DiskSizeGB = 30