Change processing priority with PowerShell

At work we use Trend Antivirus, but unfortunately it is set up by the company default installation process to run automatically Wednesday morning at “normal” processing priority. This has a very adverse effect on the performance of my computer…

I have hitherto changed the processing priority of this task manually, but decided to look into whether it could be changed by means of a PowerShell script that could be run automatically at boot time. To my aid came this article by The Scripting Guy, and here is my adapted code:

# 2013-07-25/PEH Change processing priority of a program/service

# Priority values:

# 64    (0x40)   Idle
# 16384 (0x4000) Below Normal
# 32    (0x20)   Normal
# 32768 (0x8000) Above Normal
# 128   (0x80)   High Priority
# 256   (0x100)  Real Time

$processname = “NTRTscan.exe”

$process_old = Get-WmiObject win32_process -f “name=’$processname’
$process_old.SetPriority(64) | out-null

$process_new = Get-WmiObject win32_process -f “name=’$processname‘”
Write-Host Changed processing priority for $processname from $process_old.Priority to $process_new.Priority

Ps. If anyone has an easy-to-use solution to pasting syntax-colored Powershell from (preferably) ISE into Live Writer please let me know!


3 thoughts on “Change processing priority with PowerShell

  1. PeterSullivan

    Hi I am working on this solution you can try this below code. take test maximum

    PS > (gps explorer).priorityclass
    PS > (gps explorer).priorityclass=”High”
    PS > (gps explorer).priorityclass

    “Larry__Weiss” wrote in message

    reply if its work

    • phejndorf

      You are quite right! Thanks a lot for your suggestion, no need for WMI magic here. So in my case it is a very simple one-liner:

      (Get-Process NTRTscan).PriorityClass = “BelowNormal”

      I like to use the full command names for the sake of readability, but that is of course a matter of taste 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s