Skip to content

Instantly share code, notes, and snippets.

@raymelon
Last active April 1, 2023 07:37
Show Gist options
  • Select an option

  • Save raymelon/e88e214043fbc72f2d80f3abf1b7c207 to your computer and use it in GitHub Desktop.

Select an option

Save raymelon/e88e214043fbc72f2d80f3abf1b7c207 to your computer and use it in GitHub Desktop.
PowerShell - Power Plan Single Switcher
$balanced = "BALANCED-GUID"; $highPerformance = "HIGHPERFORMANCE-GUID"; If ((powercfg /getactivescheme) -like "*" + $balanced + "*") { echo "balanced is active. setting to high performance..."; powercfg /setactive $highPerformance; powercfg /getactivescheme; echo "`nwaiting for 5min before setting back to balanced..."; Wait-Event -SourceIdentifier "ProcessStarted" -Timeout 300; powercfg /setactive $balanced; powercfg /getactivescheme; } ElseIf ((powercfg /getactivescheme) -like "*" + $highPerformance + "*") { echo "high peformance is active. setting to balanced..."; powercfg /setactive $balanced; powercfg /getactivescheme; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment