0

Win32_Process wmi query giving priority values from 0 (zero), which is the lowest priority to 31, which is highest priority.

But in SetPriority method give another type of priority Idle (64) Below Normal (16384) Normal (32) Above Normal (32768) High Priority (128) Realtime (256)

is it possible to map this two type of priority?

Or is it possible to get second type of priority for process using any script?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

I went through and figured out these values. Here's some powershell, I started Firefox and used that process as my guinea pig.

 $ff = (Get-WmiObject Win32_process -filter "name = 'firefox.exe'")[0]

[enum]::GetValues([System.Diagnostics.ProcessPriorityClass]) | % {

    Write-Host "Priority $_ int value $($_.value__)"
    [void]$ff.SetPriority($_.value__)
    $ff.get() #refresh the info in the object

    Write-Host "WMI value = $($ff.Priority)"
}
Priority Normal int value 32
WMI value = 8
Priority Idle int value 64
WMI value = 4
Priority High int value 128
WMI value = 13
Priority RealTime int value 256
WMI value = 24
Priority BelowNormal int value 16384
WMI value = 6
Priority AboveNormal int value 32768
WMI value = 10

I created a hashtable like this:

$AsWMI = @{
    Idle = 4
    BelowNormal = 6
    Normal = 8
    AboveNormal = 10
    High = 13
    Realtime = 24
}

And used it to convert the priority class name to the wmi returned value:

$AsWMI[$PriorityClass]