windowspowershellgpodomaincontroller

How to change default scheduled task process priority in Windows


I've been checking this for a while now. We have a script that creates a scheduled task and it seems that as described in many places across the net, the task priority this process and its descendants receive is 7:BelowNormal

Now this causes many issues in our testing environment which I'd like to avoid

The question here is whether I could create a GPO to override Windows' default scheduled task priority so that all new scheduled tasks will receive priority X (X being 'Normal' in my case)

I know there's an option to set the scheduled task priority upon creation but I'd like to avoid this so every new task will have a correct default priority and not the below-normal one

Thanks in advance


Solution

  • You can edit your existing task by adding the settings option

    $currentTask = Get-ScheduledTask -TaskName $taskName 
    $settings = New-ScheduledTaskSettingsSet
    $settings.Priority = 4
    Set-ScheduledTask -TaskName $taskName -Trigger $currentTask.Triggers -Action $currentTask.Actions -Settings $settings -User "user" -Password "pass"