Skip to content

Ultimate Performance Profile - Enable

functions/public/Invoke-WPFUltimatePerformance.ps1
 1function Invoke-WPFUltimatePerformance {
 2    param(
 3        [switch]$Do
 4    )
 5
 6    if ($Do) {
 7        if (-not (powercfg /list | Select-String "ChrisTitus - Ultimate Power Plan")) {
 8            if (-not (powercfg /list | Select-String "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c")) {
 9                powercfg /restoredefaultschemes
10                if (-not (powercfg /list | Select-String "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c")) {
11                    Write-Host "Failed to restore High Performance plan. Default plans do not include high performance. If you are on a laptop, do NOT use High Performance or Ultimate Performance plans." -ForegroundColor Red
12                    return
13                }
14            }
15            $guid = ((powercfg /duplicatescheme 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c) -split '\s+')[3]
16            powercfg /changename $guid "ChrisTitus - Ultimate Power Plan"
17            powercfg /setacvalueindex $guid SUB_PROCESSOR IDLEDISABLE 1
18            powercfg /setacvalueindex $guid 54533251-82be-4824-96c1-47b60b740d00 4d2b0152-7d5c-498b-88e2-34345392a2c5 1
19            powercfg /setacvalueindex $guid SUB_PROCESSOR PROCTHROTTLEMIN 100
20            powercfg /setactive $guid
21            Write-Host "ChrisTitus - Ultimate Power Plan plan installed and activated." -ForegroundColor Green
22        } else {
23            Write-Host "ChrisTitus - Ultimate Power Plan plan is already installed." -ForegroundColor Red
24            return
25        }
26    } else {
27        if (powercfg /list | Select-String "ChrisTitus - Ultimate Power Plan") {
28            powercfg /setactive SCHEME_BALANCED
29            powercfg /delete ((powercfg /list | Select-String "ChrisTitus - Ultimate Power Plan").ToString().Split()[3])
30            Write-Host "ChrisTitus - Ultimate Power Plan plan was removed." -ForegroundColor Red
31        } else {
32            Write-Host "ChrisTitus - Ultimate Power Plan plan is not installed." -ForegroundColor Yellow
33        }
34    }
35}