Add missing argument to SchTasks

This commit is contained in:
Manuel Thalmann 2023-06-29 14:22:21 +02:00
parent cba6e514bb
commit 858679a36a

View file

@ -103,7 +103,7 @@ function Enable-UACNextLogin([Context] $context) {
"`$context.RegisterReboot((Get-Item 'Registry::HKEY_USERS\$((Get-LocalUser $context.UserName).SID)'));",
"Restart-Computer -Force;")));
schtasks /Create /SC ONEVENT /MO "*[System[Provider[@Name='Application'] and EventID=$taskTrigger]]" /TR cmd.exe /TN "$tempTask";
schtasks /Create /SC ONEVENT /EC Application /MO "*[System[Provider[@Name='Application'] and EventID=$taskTrigger]]" /TR cmd.exe /TN "$tempTask";
$trigger = (Get-ScheduledTask $tempTask).Triggers;
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest;
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger;