Add Support for "-user" Parameter running under SYSTEM (#609)

Co-authored-by: Jeffrey <9938813+Raphire@users.noreply.github.com>
This commit is contained in:
soccerzockt
2026-06-07 22:51:01 +02:00
committed by GitHub
parent 33b77f19a0
commit db24865051
13 changed files with 229 additions and 132 deletions

View File

@@ -1905,6 +1905,18 @@ function Show-MainWindow {
}
}
# When running as SYSTEM, the "Current User" option is not meaningful.
# Hide it from the dropdown and default to "Other User".
$isSystem = ([Security.Principal.WindowsIdentity]::GetCurrent().User.Value -eq 'S-1-5-18')
if ($isSystem -and $userSelectionCombo.Items.Count -gt 0) {
$currentUserItem = $userSelectionCombo.Items[0]
if ($currentUserItem -is [System.Windows.Controls.ComboBoxItem]) {
$currentUserItem.Visibility = 'Collapsed'
$currentUserItem.IsEnabled = $false
}
$userSelectionCombo.SelectedIndex = 1
}
# Disable Restart Explorer option if NoRestartExplorer parameter is set
$restartExplorerCheckBox = $window.FindName('RestartExplorerCheckBox')
if ($restartExplorerCheckBox -and $script:Params.ContainsKey("NoRestartExplorer")) {