-
-
Save raspi/203aef3694e34fefebf772c78c37ec2c to your computer and use it in GitHub Desktop.
# 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 "" | |
} |
Does not work here, unfortunately. This is what I am getting:
Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting is overridden by
a policy defined at a more specific scope. Due to the override, your shell will retain its current effective
execution policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more
information please see "Get-Help Set-ExecutionPolicy".
At line:1 char:46
- ... -ne 'AllSigned') { Set-ExecutionPolicy -Scope Process Bypass }; & 'C ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], SecurityException
- FullyQualifiedErrorId : ExecutionPolicyOverride,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
Get-WmiObject :
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:6 char:22
- ... tingTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_Po ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Get-WmiObject], FileNotFoundException
- FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 0b2d69d7-a2a1-449c-9680-f91c70521c60 -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 51dea550-bb38-4bc4-991b-eacf37be5ec8 -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 6738e2c4-e8a5-4a42-b16a-e040e769756e -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 80e3c60e-bb94-4ad8-bbe0-0d3195efc663 -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 d3d55efd-c1ff-424e-9dc3-441be7833010 -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 d639518a-e56d-4345-8af2-b9f32fb26109 -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 dab60367-53fe-4fbc-825e-521d069d2456 -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 dbc9e238-6de9-49e3-92cd-8c2b4946b472 -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
powercfg -attributes 0012ee47-9041-4b5d-9b77-535fba8b1442 fc95af4d-40e7-4b6d-835a-56d131dbc80e -ATTRIB_HIDE
Exception calling "Format" with "2" argument(s): "Value cannot be null.
Parameter name: args"
At C:\Users\Administrator\Desktop\Tune & Management\Windows Inplace Upgrade\10. Power Scheme & Unlock All Power
Options\enable-all-advanced-power-settings.ps1:30 char:3
- $descr = [string]::Format("# {0}", $s.ElementName)
-
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException
@dabugen as it says: you need to set your PowerShell Execution Policy. See: Get-Help Set-ExecutionPolicy
.
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
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).
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?
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
@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)?
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 }
@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 }
god thank you @Velocet @nick4fake guys!!!
Thanks @Velocet, your script actually works WIN 11 also, your amazing
what would i change to DISABLE all advanced power settings?
Instead of enable all options you can use Power settings GUI editor PowerSettingsExplorer
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… 🤨
Sorry, I have updated link to forum thread instead of direct zip
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?
@lucr80 Just copy those lines and paste in a PowerShell.
Example output: