diff --git a/scripts/Windows/OS/User.ps1 b/scripts/Windows/OS/User.ps1 index d78b27e4..adba09e9 100644 --- a/scripts/Windows/OS/User.ps1 +++ b/scripts/Windows/OS/User.ps1 @@ -47,9 +47,13 @@ function Enable-UACNextLogin() { $propertyName = "EnableLUA"; $null = Set-ItemProperty "$keyPath" -Name "$propertyName" -Value 1; - $action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument ("-c " + ` - "Set-ItemProperty `"$keyPath`" -Name `"$propertyName`" -Value 0;" + ` - "Unregister-ScheduledTask -Force $taskName;"); + $action = New-ScheduledTaskAction -Execute "pwsh.exe" -Argument ( + [string]::Join( + " ", + @( + "-c", + "Set-ItemProperty `"$keyPath`" -Name `"$propertyName`" -Value 0;", + "Unregister-ScheduledTask -Force $taskName;"))); $trigger = New-ScheduledTaskTrigger -AtLogOn; $principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -RunLevel Highest;