Skip to content

Instantly share code, notes, and snippets.

@raspi
Last active March 8, 2026 18:05
Show Gist options
  • Select an option

  • Save raspi/203aef3694e34fefebf772c78c37ec2c to your computer and use it in GitHub Desktop.

Select an option

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 ""
}
@bfoos

bfoos commented Oct 12, 2019

Copy link
Copy Markdown

is "$descr = [string]::Format("# {0}", $s.ElementName)" correct formatting? Because it does not return the description. In fact it causes an error...

Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At D:\Powercfg-Shit\enable-all-advanced-power-settings.ps1:30 char:3

  • $descr = [string]::Format("# {0}", $s.ElementName)
  • + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException
    

@banicpe

banicpe commented Dec 21, 2019

Copy link
Copy Markdown

I forgot to backup default settings. can someone post me original default hidden/unhidden attributes please?

ps - (btw, script works just as it should, i used wind10, administrator account).

@ar-ml

ar-ml commented Dec 29, 2019

Copy link
Copy Markdown

Since I have used above script in windows powershell, I have lost all advanced power settings and can not get them back (even the ones I had before are gone now). Windows is diplaying "Energyplaninformation not available" now.
I tried to undo my changes by setting most settings back to +ATTRIB_HIDE and only some to -ATTRIB_HIDE - but it did not work.
See screenshot below.
Any idea how to fix this?
2019-12-29 05_50_22-Enable all advanced power settings in Windows

@banicpe

banicpe commented Dec 29, 2019

Copy link
Copy Markdown

Launch your Registry Editor (Windows button and type “Regedit“)
Navigate to: “Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power“
Select the entry called ‘CsEnabled‘
Change the “Value data” to “1” and select “OK“ (in the case it's alreaedy 1 try 0 and reboot and again to 1)
Reboot your machine

@ar-ml

ar-ml commented Dec 31, 2019

Copy link
Copy Markdown

@banicpe thx very much! Setting Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power 'CsEnabled‘ to "0" and rebooting, worked for me. I can see all Advanced Energy Options now! Great!

Anyone knows why MS hid those settings in the first place? Is it dangerous to fiddle around with them (e.g. with processor performance settings)?

@Slach

Slach commented Jun 10, 2020

Copy link
Copy Markdown

@banicpe @ar-ml and all others who will landing to this page from StackOverflow or google

also helpful
export
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings
and change all
"Attributes"=dword:00000001
to
"Attributes"=dword:00000000

and import PowerSettings back

@Velocet

Velocet commented Jun 15, 2020

Copy link
Copy Markdown

I have written my own version which works with PowerShell 7 and every Windows version: Unlock-PowerCfg.ps1

# Unlock Power Plans by disabling "Connected Standby"
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power' -Name 'CSEnabled' -Value 0 -Force

# Unlock hidden options
$PowerSettings = Get-ChildItem -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse -Depth 1 | Where-Object { $_.PSChildName -NotLike 'DefaultPowerSchemeValues' -and $_.PSChildName -NotLike '0' -and $_.PSChildName -NotLike '1' }
ForEach ($item in $PowerSettings) { Set-ItemProperty -Path ($item).Replace('HKEY_LOCAL_MACHINE','HKLM:') -Name 'Attributes' -Value 2 -Force }

@nick4fake

Copy link
Copy Markdown

@Velocet, small fix:

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power' -Name 'CSEnabled' -Value 0 -Force
    # Unlock hidden options
    $PowerSettings = Get-ChildItem -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse -Depth 1 | Where-Object { $_.PSChildName -NotLike 'DefaultPowerSchemeValues' -and $_.PSChildName -NotLike '0' -and $_.PSChildName -NotLike '1' }
    ForEach ($item in $PowerSettings) { Set-ItemProperty -Path ($item).Name.Replace('HKEY_LOCAL_MACHINE','HKLM:') -Name 'Attributes' -Value 2 -Force }

@VLDG2712

VLDG2712 commented Feb 3, 2023

Copy link
Copy Markdown

god thank you @Velocet @nick4fake guys!!!

@AutomationEngineer0817

Copy link
Copy Markdown

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

@lavinnyv

lavinnyv commented Sep 8, 2023

Copy link
Copy Markdown

what would i change to DISABLE all advanced power settings?

@Argimko

Argimko commented Jun 4, 2024

Copy link
Copy Markdown

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

@Velocet

Velocet commented Jun 5, 2024

Copy link
Copy Markdown

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

Argimko commented Jun 5, 2024

Copy link
Copy Markdown

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

@lucr80

lucr80 commented Sep 27, 2024

Copy link
Copy Markdown

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

Velocet commented Oct 3, 2024

Copy link
Copy Markdown

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

@JBIRO

JBIRO commented Jul 17, 2025

Copy link
Copy Markdown

guys i need to get back to default settings any help ?

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