Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hlorand/35609badf01e4f40a86dfe034c2f13a4 to your computer and use it in GitHub Desktop.
Save hlorand/35609badf01e4f40a86dfe034c2f13a4 to your computer and use it in GitHub Desktop.
#Requires -RunAsAdministrator
# unlocks hidden power options (in Windows Control Panel / Power Schemes)
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) { $path = $item -replace "HKEY_LOCAL_MACHINE","HKLM:"; Set-ItemProperty -Path $path -Name 'Attributes' -Value 2 -Force }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment