SetPriority method of the Win32_Process Class
Applies to: desktop apps only
The SetPriority WMI class method attempts to change the execution priority of the process. To set the priority to Realtime, the caller must have SeIncreaseBasePriorityPrivilege (SE_INC_BASE_PRIORITY_PRIVILEGE). Without this privilege, the highest the priority can be set to is High Priority.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.
Syntax
uint32 SetPriority( [in] sint32 Priority );
Parameters
- Priority [in]
-
New priority class for the process.
Value Meaning - 64 (0x40)
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.
- 16384 (0x4000)
Below Normal
Indicates a process that has priority above IDLE_PRIORITY_CLASS, but below NORMAL_PRIORITY_CLASS. For Windows 2000.
- 32 (0x20)
Normal
Specified for a process with no special scheduling needs.
- 32768 (0x8000)
Above Normal
Indicates a process that has priority above NORMAL_PRIORITY_CLASS, but below HIGH_PRIORITY_CLASS. For Windows 2000.
- 128 (0x80)
High Priority
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. An example is the Task List, which must respond quickly when called by the user, regardless of the load on the operating system. Use extreme care when using the high-priority class, because a high-priority class application can use nearly all of the available CPU time.
- 256 (0x100)
Real Time
Specified for a process that has 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. For example, a real-time process that executes for more than a very brief interval can cause disk caches not to flush or a mouse to be unresponsive.
Return value
| Return code | Description |
|---|---|
|
Successful completion |
|
Access denied |
|
Insufficient Privilege |
|
Unknown Failure |
|
Path Not Found |
|
Invalid Parameter |
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Namespace |
\root\CIMV2 |
|
MOF |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/9/2012
- 10/28/2009
- rogerdpack2