Hi I'm doing some scripting to add a task on a Task Scheduler. However I need to have a script to select the "run with highest privileges".
Sample code:
Dim settings
Set settings = taskDefinition.Settings
settings.Enabled = True
settings.StartWhenAvailable = True
settings.Hidden = False
You can accomplish this with the
-RunLevel Highest
flag forNew-ScheduledTaskPrincipal
in PowerShell.Example:
PowerShell ScheduledTask documentation.