use system for task #184

This commit is contained in:
zoicware
2026-03-10 03:42:19 -04:00
committed by GitHub
parent 8c9afebaea
commit 8cdae31484

View File

@@ -2622,14 +2622,12 @@ shell.Run command,0
Set-Content -Path $vbsPath -Value $vbsScriptContent -Force
Write-Status -msg 'Creating Update Cleanup Scheduled Task...'
#$userSid = (Get-LocalUser -Name $env:USERNAME).SID.Value
$userSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
$action = New-ScheduledTaskAction -Execute 'wscript.exe' -Argument "$env:ProgramData\RemoveAI-UpdateCleanup-Silent.vbs"
$trigger = New-ScheduledTaskTrigger -AtLogOn
$principal = New-ScheduledTaskPrincipal -UserId $userSid -LogonType ServiceAccount -RunLevel Highest
$principal = New-ScheduledTaskPrincipal -UserId 'S-1-5-18'
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
#create update cleanup checker task
Register-ScheduledTask -TaskName 'RemoveAI-UpdateCleanupChecker' -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Force | Out-Null
Register-ScheduledTask -TaskPath '\' -TaskName 'RemoveAI-UpdateCleanupChecker' -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Force | Out-Null
}
else {