Skip to content

Instantly share code, notes, and snippets.

@Velocet
Last active October 30, 2025 06:16
Show Gist options
  • Save Velocet/7ded4cd2f7e8c5fa475b8043b76561b5 to your computer and use it in GitHub Desktop.
Save Velocet/7ded4cd2f7e8c5fa475b8043b76561b5 to your computer and use it in GitHub Desktop.

Revisions

  1. Velocet revised this gist May 11, 2022. 3 changed files with 14 additions and 13 deletions.
    13 changes: 6 additions & 7 deletions Unlock-PowerCfg.ps1
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,9 @@
    #Requires -RunAsAdministrator
    # Unlock-PowerCfg - v22.05.11

    if (!$IsLinux -and !$IsMacOS) {
    # Unlock Power Plans by disabling "Connected Standby"
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power' -Name 'CSEnabled' -Value 0 -Force
    # Disable "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 }
    }
    # Get Power Settings entries and add/set 'Attributes' to 2 to unhide
    $PowerCfg = (Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse).Name -notmatch '\bDefaultPowerSchemeValues|(\\[0-9]|\b255)$'
    foreach ($item in $PowerCfg) { Set-ItemProperty -Path $item.Replace('HKEY_LOCAL_MACHINE','HKLM:') -Name 'Attributes' -Value 2 -Force }
    2 changes: 1 addition & 1 deletion Unlock-PowerCfgOneLiner.ps1
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    gci -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse -Depth 1 | ? { $_.PSChildName -NotLike 'DefaultPowerSchemeValues' -and $_.PSChildName -NotLike '0' -and $_.PSChildName -NotLike '1' } | % {sp -Path ($_).Replace('HKEY_LOCAL_MACHINE','HKLM:') -Name 'Attributes' -Value 2 -Force }
    (gci 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse).Name -notmatch '\bDefaultPowerSchemeValues|(\\[0-9]|\b255)$' | % {sp $_.Replace('HKEY_LOCAL_MACHINE','HKLM:') -Name 'Attributes' -Value 2 -Force}
    12 changes: 7 additions & 5 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,11 @@
    Unlock every Power Plan and corresponding option on Windows. Just paste in an elevated PowerShell.
    Unlock-PowerCfg 1.1.0

    Use this instead of some shady PowerCfg commands or .reg file as this script works even for newer/unknown settings: It will look up the PowerSettings registry hive and just add or change a value (Attributes = 2) on the corresponding option to reveal it.
    Unlock every Power Plan Scheme/Setting on Windows 10/11. Just paste in an elevated PowerShell.

    The OneLiner version is untested but should also work...
    Use this instead of some incomplete PowerCfg commands or old .reg files as this script works even for newer/unknown settings: It will look up the PowerSettings registry hive and add or change a value (Attributes = 2) to reveal it.

    Requirements:
    - Windows 7 - 10
    - Elevated PowerShell v2 - v7
    - Windows 7 - 11
    - PowerShell v2 - v7 with admin rights

    Also have a look at: https://gist.github.com/raspi/203aef3694e34fefebf772c78c37ec2c
  2. Velocet revised this gist Jun 15, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,4 @@ The OneLiner version is untested but should also work...

    Requirements:
    - Windows 7 - 10
    - Elevated PowerShell v2 - v7 (started with Administrator rights)
    - Elevated PowerShell v2 - v7
  3. Velocet revised this gist Jun 15, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,4 @@ The OneLiner version is untested but should also work...

    Requirements:
    - Windows 7 - 10
    - PowerShell v2 - v7
    - Elevated PowerShell v2 - v7 (started with Administrator rights)
  4. Velocet revised this gist Jun 15, 2020. 2 changed files with 5 additions and 2 deletions.
    1 change: 1 addition & 0 deletions Unlock-PowerCfgOneLiner.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    gci -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings' -Recurse -Depth 1 | ? { $_.PSChildName -NotLike 'DefaultPowerSchemeValues' -and $_.PSChildName -NotLike '0' -and $_.PSChildName -NotLike '1' } | % {sp -Path ($_).Replace('HKEY_LOCAL_MACHINE','HKLM:') -Name 'Attributes' -Value 2 -Force }
    6 changes: 4 additions & 2 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@ Unlock every Power Plan and corresponding option on Windows. Just paste in an el

    Use this instead of some shady PowerCfg commands or .reg file as this script works even for newer/unknown settings: It will look up the PowerSettings registry hive and just add or change a value (Attributes = 2) on the corresponding option to reveal it.

    The OneLiner version is untested but should also work...

    Requirements:
    Windows 7 - 10
    PowerShell v2 - v7
    - Windows 7 - 10
    - PowerShell v2 - v7
  5. Velocet created this gist Jun 15, 2020.
    10 changes: 10 additions & 0 deletions Unlock-PowerCfg.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #Requires -RunAsAdministrator

    if (!$IsLinux -and !$IsMacOS) {
    # 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 }
    }
    7 changes: 7 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Unlock every Power Plan and corresponding option on Windows. Just paste in an elevated PowerShell.

    Use this instead of some shady PowerCfg commands or .reg file as this script works even for newer/unknown settings: It will look up the PowerSettings registry hive and just add or change a value (Attributes = 2) on the corresponding option to reveal it.

    Requirements:
    Windows 7 - 10
    PowerShell v2 - v7