Skip to content

Commit

Permalink
Merge pull request #50 from basictheprogram/issue-49
Browse files Browse the repository at this point in the history
WIP #49
  • Loading branch information
StefanScherer committed Dec 8, 2017
2 parents 20a298f + 29ce6ae commit 73e4a9d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/set-powerplan.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
Try {
Write-Output "Set power plan to high performance"

$HighPerf = powercfg -l | %{if($_.contains("High performance")) {$_.split()[3]}}

# $HighPerf cannot be $null, we try activate this power profile with powercfg
#
if ($HighPerf -eq $null)
{
throw "Error: HighPerf is null"
}

$CurrPlan = $(powercfg -getactivescheme).split()[3]

if ($CurrPlan -ne $HighPerf) {powercfg -setactive $HighPerf}

} Catch {
Write-Warning -Message "Unable to set power plan to high performance"
Write-Warning $Error[0]
}

0 comments on commit 73e4a9d

Please sign in to comment.