Battery Upgrade

For the users who want to tweak as many settings as possible I feel like I should share the script I’ve been ripping off for a while. This is for Windows only, Linux users should look at this thread here:

Back to the topic on hand, it took me a bit to find OG thread for the Windows thing. Here is the thread link and the powershell code below that. I saved it out as a .ps1 script to run from admin, but for the non-powershell users out there feel free to open powershell as admin and copy paste the script in and run from the terminal. Selecting everything into a 2 will make it show up in your advanced power options if the OS allows it. If it doesn’t work at all, remember to re run script as admin and it should work for you.

https://www.tenforums.com/general-support/142867-missing-advanced-power-options-2.html

Edit: Thanks to @john_doe and @Tyler_Quinlivan for pointing out and fixing a bug with how the script gets pasted and formatted.

------------------------ script below ------------------------

Function Toggle-PowerSettingsVisibility {
$Title = 'Select option(s) to toggle visibility'
$PowerSettings = 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings'
@( [PSCustomObject]@{
Attributes = 0
PSChildName = '{ -- No Changes -- }'
Name = ' "Safety" row to clear selection'
} ) +
@( Get-ChildItem $PowerSettings -Recurse | ? Property -contains 'Attributes' | Get-ItemProperty |
Select Attributes, PSCHildName,
@{ N = 'Name' ; E = { $_.FriendlyName.Split(',')[-1] }} ) | Sort PSChildName |
Out-GridView -Passthru -Title $Title | ForEach {
$Splat = @{
Path = Resolve-Path "$PowerSettings\*\$($_.PSChildName)"
Name = 'Attributes'
Value = -bNot $_.Attributes -bAnd 0x0000003
}
Set-ItemProperty @Splat -Confirm
}
}
Toggle-PowerSettingsVisibility

5 Likes