I would like to lower the priority of the jobs that I start with Start-Job in PowerShell scripts. Is this possible?
Can I set PowerShell 'Start-Job' with low priority?
7.9k Views Asked by Barry Chum At
2
There are 2 best solutions below
0

If you have launched it then you can use this:
$a = gps powershell
$a.PriorityClass = "BelowNormal"
Or you can use this using the key:
Get-WmiObject Win32_process -filter 'name = "notepad.exe"' | foreach-object { $_.SetPriority(32) }
The priority codes are as follows:
256 REALTIME
128 HIGH_PRIORITY
32768 ABOVE_NORMAL
32 NORMAL
16384 BELOW_NORMAL
64 IDLE
I used this trick right in a job's code (it can be optional, controlled by a parameter):
Available priority values: Lowest, BelowNormal, Normal, AboveNormal, Highest