Processes - Set Priority

Declaration

<AMPROCESSES ACTIVITY="setpriority" DOMAINNAME="text" REMOTEMACHINE="text" USERNAME="text" PASSWORD="text(encrypted)" PROCESSNAME="text" PRIORITY="text(options)" />

See Also

Processes - Set Affinity | Processes - Get Information | Processes - End | Processes - Start

Description

Changes the execution priority of one or more instances of a process. If multiple instances of the process exist, priority can be set for the oldest, newest, all or no instances of the process. This activity supports local and remote processes.

NOTE: To set the priority to Realtime, the user must have proper security permissions to do so.

Practical Usage

Commonly used to adjust specific process priorities to improve performance or prevent badly behaved processes from negatively impacting the system's overall responsiveness.

Parameters

Process Properties

Property

Type

Req'd

Default

Markup

Description

Find by Name

Text

No

(Empty)

  1. PROCESS="NOTEPAD.EXE"

  2. PROCESS="C:\folder\process.exe

If enabled, specifies the name of the process in which to set. This parameter supports entry of the absolute (full) path or relative (file name only) path of the process. If this parameter is enabled, the Find by Process ID parameter becomes inactive. This parameter is enabled by default.

If multiple instances of the process exist, apply changes to

Text (options)

No

Upper Case

SAMEPROCESS="nothing"

Indicates which process instance should be set in case more than one instance of a given process is running. The available options are:

  • Oldest (default) - Only the oldest running instance of the process will have its priority set.

  • Newest - Only the newest (last) running instance of the process will have its priority set.

  • None - No instance of the process will have its priority set.

  • All - All instances of the process will have its priority set.

Find by Process ID

Text

No

Yes

PROCESSID="11452"

If enabled, specifies the process ID of the process to set. If this parameter is enabled, the Find by Name  parameter becomes inactive. This parameter is disabled by default.

NOTE: Use the Processes - Get Info activity to retrieve the process ID of a given process.

Change process priority to

Yes/No

No

No

PRIORITY="Idle"

The process priority level to set the process to. The available options are:

  • Normal (default) - Specified for a process with no special scheduling needs.

  • Below Normal - Indicates a process that has priority above Idle but below Normal priority.

  • Above Normal - Indicates a process that has priority above Normal but below High priority.

  • Idle - Specified for a process with threads that run only when the system is idle. The threads of the process are preempted by the threads of a process that run in a higher priority class, for example, a screen saver. The idle-priority class is inherited by child processes.

  • High - Specified for a process that performs time-critical tasks that must be executed immediately. The threads of the process preempt the threads of normal or idle priority class processes.

  • Realtime - The highest possible priority. The threads of the process preempt the threads of all of the other processes, including operating system processes that perform important tasks. Note that the user must have proper security permissions to set priority to this level.

Computer Properties

Property

Type

Req'd

Default

Markup

Description

Local computer

---

---

---

---

If enabled, specifies that the process to set resides on the local machine. This parameter is enabled by default. If this parameter is selected, the Another Computer parameter becomes inactive. This is a visual mode parameter used during design time only, therefore, it contains no markups.

Another computer

---

---

---

---

If enabled, specifies that the process to set resides on a remote machine. Other parameters become active if this parameter is enabled. If this parameter is selected, the Local Computer parameter becomes inactive. This is a visual mode parameter used during design time only. Therefore, it contains no markups.

Machine Name

Text

Yes

(Empty)

  1. REMOTEMACHINE="pcname.domain.com"

  2. REMOTEMACHINE="xxx.xxx.xxx.xxx"

The host name or IP address of the remote machine where the process to set resides. This parameter is available only if the Another Computer parameter is enabled.

Machine Domain

Text

No

(Empty)

DOMAINNAME="netauto"

The domain name of the remote machine where the process to set resides. This parameter is available only if the Another Computer parameter is enabled.

Username

Text

No

(Empty)

USERNAME="Bruce.Wayne"

A valid user name used to log onto the remote machine in which the process to set resides. This parameter is available only if the Another Computer parameter is enabled.

Password

Text

No

(Empty)

PASSWORD="encrypted"

The password corresponding to the username entered in the Username field. This parameter is available only if the Another Computer parameter is enabled.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties allows you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Example 1: Set priority of process "Photoshop.exe" on the local computer to "Above normal".

 

<AMPROCESSES ACTIVITY="setpriority" PROCESSNAME="Photoshop.exe" SAMEPROCESS="all" PRIORITY="abovenormal" />

 

 

Example 2: Set priority of process "Photoshop.exe" on "remoteMachine.com/theRemoteMachine" to "High".

 

<AMPROCESSES ACTIVITY="setpriority" DOMAINNAME="remoteMachine.com" REMOTEMACHINE="theRemoteMachine" USERNAME="user" PASSWORD="AM2ooXWPmWe55c=aME" PROCESSNAME="Photoshop.exe" SAMEPROCESS="all" PRIORITY="high" />

 

↑ Top of Page