mirror of
https://github.com/zoicware/RemoveWindowsAI.git
synced 2026-03-19 17:16:19 +01:00
use system for task #184
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user