Enhance output documentation and error handling

This commit is contained in:
Jeffrey
2026-08-22 17:14:09 +02:00
parent 80eadd531c
commit c921730703
17 changed files with 228 additions and 66 deletions
+2 -2
View File
@@ -234,8 +234,8 @@ function Get-AppRemovalScopeTarget {
"AppRemovalScopeAllUsers" { return 'AllUsers' }
"AppRemovalScopeCurrentUser" { return 'CurrentUser' }
default {
Write-Warning "Unrecognized app-removal scope item '$($selectedItem.Name)'. Defaulting to AllUsers."
return 'AllUsers'
Write-Warning "Unrecognized app-removal scope item '$($selectedItem.Name)'. Skipping app removal."
return $null
}
}
}
+2 -3
View File
@@ -114,8 +114,7 @@ function Show-ApplyModal {
try {
Invoke-AllChanges
$featureFailureCount = [int]$script:FeatureFailures
$failureCount = $featureFailureCount
$failureCount = [int]$script:FeatureFailures + [int]$script:AppRemovalFailures
$appRemovalVerificationUnavailable = [bool]$script:AppRemovalVerificationUnavailable
# Restart explorer if requested
@@ -156,7 +155,7 @@ function Show-ApplyModal {
}
else {
$script:ApplyCompletionTitleEl.Text = "Changes Applied with Errors"
$script:ApplyCompletionMessageEl.Text = "$featureFailureCount change(s) failed. See console for details."
$script:ApplyCompletionMessageEl.Text = "$failureCount change(s) failed. See console for details."
}
} else {
Write-Host "All changes have been applied successfully!"
+7 -5
View File
@@ -670,13 +670,15 @@ function Show-MainWindow {
if ($selectedApps.Count -gt 0) {
if (-not (Confirm-UnsafeAppRemoval -SelectedApps $selectedApps -Owner $window)) { return }
$scopeTarget = Get-AppRemovalScopeTarget -AppRemovalScopeCombo $appRemovalScopeCombo -OtherUsernameTextBox $otherUsernameTextBox
if ([string]::IsNullOrWhiteSpace($scopeTarget)) {
Write-Warning 'App removal was cancelled because the selected removal scope is invalid.'
return
}
Add-Parameter 'RemoveApps'
Add-Parameter 'Apps' ($selectedApps -join ',')
$scopeTarget = Get-AppRemovalScopeTarget -AppRemovalScopeCombo $appRemovalScopeCombo -OtherUsernameTextBox $otherUsernameTextBox
if (-not [string]::IsNullOrWhiteSpace($scopeTarget)) {
Add-Parameter 'AppRemovalTarget' $scopeTarget
}
Add-Parameter 'AppRemovalTarget' $scopeTarget
}
# Apply dynamic tweaks