Force Scheduled Task Unregistration
This commit is contained in:
parent
6a4ff4645a
commit
c3d8e79fcf
1 changed files with 2 additions and 1 deletions
|
@ -49,7 +49,8 @@ function Enable-UACNextLogin() {
|
|||
|
||||
$action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument ("-c " + `
|
||||
"Set-ItemProperty `"$keyPath`" -Name `"$propertyName`" -Value 0;" + `
|
||||
"Unregister-ScheduledTask $taskName;");
|
||||
"Unregister-ScheduledTask -Force $taskName;");
|
||||
|
||||
$trigger = New-ScheduledTaskTrigger -AtLogOn;
|
||||
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest;
|
||||
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger;
|
||||
|
|
Loading…
Reference in a new issue