# Kod ustawia priorytet procesu

use Win32::OLE;
$Win32::OLE::Warn = 3;

use constant NORMAL => 32;
use constant IDLE => 64;
use constant HIGH_PRIORITY => 128;
use constant REALTIME => 256;
use constant BELOW_NORMAL => 16384;
use constant ABOVE_NORMAL => 32768;

# ------ KONFIGURACJA SKRYPTU ------
$strComputer = '.';
$intPID = 2880; # wstaw identyfikator PID danego procesu
$intPriority = ABOVE_NORMAL; # wstaw jedn z powyszych staych
# ------ KONIEC KONFIGURACJI ---------
print "Identyfikator PID procesu: $intPID\n";
$objWMIProcess = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . '\\root\\cimv2:Win32_Process.Handle=\'' . $intPID . '\'');
print 'Nazwa procesu: ' . $objWMIProcess->Name, "\n";
$intRC = $objWMIProcess->SetPriority($intPriority);
if ($intRC == 0) {
    print "Ustawianie priorytetu zostao zakoczone powodzeniem.\n";
}
else {
    print 'Nie mona byo ustawi priorytetu. Kod bdu: ' . $intRC, "\n";
}
