Fix undo when using presets

This commit is contained in:
Raphire
2026-03-22 23:44:59 +01:00
parent a54c3c6918
commit cfc868ba91
2 changed files with 9 additions and 2 deletions

View File

@@ -336,11 +336,12 @@ foreach ($Param in $script:ControlParams) {
# Guard: Undo mode requires at least one actionable, non-control parameter.
if ($script:Params.ContainsKey('Undo')) {
$loadsSettingsFromPreset = $RunDefaults -or $RunDefaultsLite -or $RunSavedSettings
$undoTargets = @($script:Params.Keys | Where-Object {
($script:ControlParams -notcontains $_) -and $_ -ne 'Apps' -and $_ -ne 'CreateRestorePoint'
})
if ($undoTargets.Count -eq 0) {
if ($undoTargets.Count -eq 0 -and -not $loadsSettingsFromPreset) {
Write-Error "The -Undo parameter requires at least one setting/feature parameter to revert."
AwaitKeyToExit
}