Change PowerShell Script Process Priority

Lower or raise the process priority of your PowerShell script

  1. Ian
    If you've got an intensive PowerShell script, you may find that running it can slow your system to a crawl - as it is given "default" process priority and has to compete with other system applications. Likewise, you may have an important script you wish to run with priority over other system tasks.

    You can change the process priority of your script by adding the following code to the beginning, where PRIORITYLEVEL is equal to one of the following options:
    • Idle
    • BelowNormal
    • Normal
    • AboveNormal
    • High
    • RealTime

    Code (PowerShell):
    $process = Get-Process -Id $pid
    $process.PriorityClass = 'PRIORITYLEVEL'
    I run several scripts using the "idle" priority option, as they are CPU intensive tasks that can take as long as required to finish. This frees up system resources for running more important tasks.
    Regedit32 likes this.