Dishonored2 CPU prioroty watcher

Start Dishonored 2.

Alt-Tab out and open PowerShell as admin (right-click > Run as administrator)

Paste this code:

 

##### START CODE #####

# priority hash

$priorityhash = @{-2="Idle";-1="BelowNormal";0="Normal";1="AboveNormal";2="High";3="RealTime"} 

 

# priority you want to force

$priority = 2

 

# name of the process to watch

$processName = "dishonored2"

 

# loop control

$stop = $false

 

do {

    

    try {

        $processID = (Get-Process $processName -ErrorAction Stop).Id

    } catch {

        Write-Error "Can't find the process: $processName"

        $stop = $true

    }   

 

 

    if ((Get-Process -Id $processID).priorityclass -ne $priorityhash[$priority]) {

        (Get-Process -Id $processID).priorityclass = $priorityhash[$priority] 

        Write-Host "Process priority changed."

    } else {

        Write-Host "Current priority: $((Get-Process -Id $processID).priorityclass)"

    }

 

    sleep -m 250

 

} until ($stop)

##### END CODE #####

 

Play Dishonored2.

 

This code will check the processor priority of the selected process (dishonored2) every 0.25 second and change the priority back to High if it has changed. Loop will autostop once the dishonored2 process terminates.