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
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"
Another way of doing this, without using powershell:
Export the task from the GUI: in the Task Scheduler, right-click the task and select "Export…" and save the exported task in a file
Change the priority
2.1 Open the file in a text editor (like Notepad). This is the XML that defines the task. Each action will have a section, which contains <Settings>
, which contains a <Priority>
element.
2.2 Change the value. The default value, for “below normal”, is 7. You can use either 6, 5, or 4 for “normal” priority. You will not usually want to go above “normal”. 6 will probably work for you.
2.3 Save the file (for example, "c:\mytask.xml")
Import the task using command line/schtasks:schtasks /DELETE /tn "\TASKSCHEDULER-FOLDER-PATH\TASK-IMPORT-NAME"
(you need to first remove the existing task, to create a new one from the command line using schtasks)schtasks /create /xml "c:\mytask.xml" /tn "\TASKSCHEDULER-FOLDER-PATH\TASK-IMPORT-NAME"
I had 220 machines to do that, so I did it this way. Since all machines had the same configuration, I could copy the same XML file to all machines and recreate the scheduled task based on the XML. See a little more details on the different priorities here. This answer was based on this article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With