Set Processes Priority to Normal

Sets the priority of all processes within a session to normal
Version 1.3.3
Created on 2019-05-13
Modified on 2019-05-17
Created by trentent.tye
Downloads: 63

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[-1]) {
            (Get-Process -Id $process.id).priorityclass = $priorityhash[0] 
        }
    } catch {
        Write-Host "Skipped process $($process.name)"
    }
}