Set Processes Priority to BelowNormal

Sets the priority of all processes within a session to BelowNormal

Version: 1.5.5
Created: 2019-05-13T13:29:53.987
Modified: 2019-05-17T15:14:05.573
Creator: trentent.tye
Downloads: 44
Tags:
The Script Copy Script Copied to clipboard

$sessionId = $args[0]

$userProcesses = get-process | Where {$_.SI -eq $sessionId}
$priorityhash = @{-2=”Idle”;-1=”BelowNormal”;0=”Normal”;1=”AboveNormal”;2=”High”;3=”RealTime”}

foreach ($process in $userProcesses) {
try {
if ($process.priorityclass -eq $priorityhash[0]) {
(Get-Process -Id $process.id).priorityclass = $priorityhash[-1]
}
} catch {
Write-Host “Skipped process $($process.name)”
}
}

START YOUR TRIAL

Get Your Download Link

Gain access to ControlUp from your PC. Register and get a link to start your Free Trial.