Skip to content

Instantly share code, notes, and snippets.

@raspi
Last active November 2, 2024 06:13
Show Gist options
  • Save raspi/203aef3694e34fefebf772c78c37ec2c to your computer and use it in GitHub Desktop.
Save raspi/203aef3694e34fefebf772c78c37ec2c to your computer and use it in GitHub Desktop.
Enable all advanced power settings in Windows.
# List all possible power config GUIDs in Windows
# Run: this-script.ps1 | Out-File powercfg.ps1
# Then edit and run powercfg.ps1
# (c) Pekka "raspi" Järvinen 2017
$powerSettingTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSetting
$powerSettingInSubgroubTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingInSubgroup
Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingCapabilities | ForEach-Object {
$tmp = $_.ManagedElement
$tmp = $tmp.Remove(0, $tmp.LastIndexOf('{') + 1)
$tmp = $tmp.Remove($tmp.LastIndexOf('}'))
$guid = $tmp
$s = ($powerSettingInSubgroubTable | Where-Object PartComponent -Match "$guid")
if (!$s) {
return
}
$tmp = $s.GroupComponent
$tmp = $tmp.Remove(0, $tmp.LastIndexOf('{') + 1)
$tmp = $tmp.Remove($tmp.LastIndexOf('}'))
$groupguid = $tmp
$s = ($powerSettingTable | Where-Object InstanceID -Match "$guid")
$descr = [string]::Format("# {0}", $s.ElementName)
$runcfg = [string]::Format("powercfg -attributes {0} {1} -ATTRIB_HIDE", $groupguid, $guid)
Write-Output $descr
Write-Output $runcfg
Write-Output ""
}
@AutomationEngineer0817
Copy link

Thanks @Velocet, your script actually works WIN 11 also, your amazing

@lavinnyv
Copy link

lavinnyv commented Sep 8, 2023

what would i change to DISABLE all advanced power settings?

@Argimko
Copy link

Argimko commented Jun 4, 2024

Instead of enable all options you can use Power settings GUI editor PowerSettingsExplorer

@Velocet
Copy link

Velocet commented Jun 5, 2024

At least for my solution you don’t enable them: All settings become visible. Thats it.

I also wouldn’t download something from a random mediafire link posted on the internet… 🤨

@Argimko
Copy link

Argimko commented Jun 5, 2024

Sorry, I have updated link to forum thread instead of direct zip

@lucr80
Copy link

lucr80 commented Sep 27, 2024

Could someone explain the basics to me? Do you have a video explaining how to install? Or is it just right-clicking and running in PowerShell?

@Velocet
Copy link

Velocet commented Oct 3, 2024

@lucr80 Just copy those lines and paste in a PowerShell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment