I wanted to set up my Windows laptop so that it only switches to Power Saver mode when I say so, not automatically when I unplug it, and switches back to Balanced mode automatically only when it’s plugged in (or specifically without me having to remember to switch it back eventually--one less thing to worry about). I don’t want screen brightness or sleep settings changed — just the power plan switch.
This is a thing that happens like clockwork every Sunday. I have a zoom meeting that I stream and record to the cloud for later watching by those who missed the meeting. But to make things easier on myself, when I come to this meeting I only bring my laptop, mouse, a power bank and type c cord just incase (the power bank guarantees external power whether or not there's a wall jack to plug into), and I want to run down my battery somewhat on a regular basis but not every time I use it, so this meeting is that time that I do so. But sometimes I go to this meeting and then I need to do some work without being plugged in for a while. So I want the option to use power saving mode manually for when I know these events will happen. If I set it to automatically use power saving mode every time I'm on battery then I will lose performance even in times when I wont be on battery for long enough to worry about running out of power. So I don't want to use this all the time.
First, I checked existing power schemes with:
powercfg /list
I saw the Balanced and Power Saver plan. I duplicated the Power Saver scheme to keep a fresh copy:
powercfg /duplicatescheme a1841308-3541-4fab-bc81-f71556f20b4a
I switched to Power Saver with:
powercfg /setactive <new-guid>
(I replaced <new-guid> with the GUID returned from duplication)
There is an easy way to determine the GUID numbers for both power saving and balanced modes or any of the modes you have on your machine:
powercfg /list
Mine were:
Balanced: 381b4222-f694-41f0-9685-ff5bb260df2e
a1841308-3541-4fab-bc81-f71556f20b4a
Next, I wanted to detect when the power source changes (plugged/unplugged) and automatically switch to Balanced mode only on plugging in. After trying it a few times, the following command worked and gave me a list of the past several times i either plugged in my laptop or unplugged it:
Get-WinEvent -LogName System -FilterXPath "*[System[(EventID=105)]]" -MaxEvents 10 | Where-Object {$_.ProviderName -eq "Microsoft-Windows-Kernel-Power"} | Format-Table TimeCreated, Message -AutoSize
To automate the plan switch on plug-in, I created a PowerShell script, which listens for an event ID 105, checking for current power source status changes. If plugged in, set power plan to Balanced. Otherwise, do nothing, leaving Power Saver mode only when I manually activate it. I concluded that if I only get an indication of a power source change with the 105 log (yes, there are ways to check more specifically what the power source is), then I just need to set it to always change the power plan to Balanced since that is the only thing I want automated. That way the manually activated power saver script can work on its own, and it will automatically switch the second I get power.
Then I created a Task Scheduler task triggered on Event ID 105 to run this script with highest privileges.
Press Windows key > type "Task Scheduler" > press Enter > In Task Scheduler window, click "Create Task" (not create basic task) on right panel > In General tab, name it "Power Source Switch" > check "Run with highest privileges" > Go to Triggers tab > Click "New..." > In Begin the task dropdown, select "On an event" > Set Log to "System" > Set Source to "Microsoft-Windows-Kernel-Power" > Set Event ID to "105" > Click OK > Go to Actions tab > Click "New..." > Action: "Start a program" > In Program/script, enter "powershell.exe" > In Add arguments, enter "-Command
"powercfg /setactive 381b4222-f694-41f0-9685-ff5bb260df2e" (this is with my particular GUID number for Balanced mode >
Click OK > Go to Conditions tab > make sure "Start the task only if the computer is on AC power" is checked > Click OK to save task.
I tested the task I just scheduled by unplugging and switching to power saver mode in PowerShell with Administrator privileges using the following command:
powercfg /setactive a1841308-3541-4fab-bc81-f71556f20b4a
Then to verify it was in power saver mode and then again after it switched back to balanced mode, I used the following command:
powercfg /list
The asterisk indicated Power Saving mode.
Then I plugged power back in and after a few seconds, a blue screen appeared and disappeared, I ran the list command again, and the asterisk indicated it had been set to Balanced mode. Success!
To make manual activation of Power Saver easy, I wrote a batch file with:
powercfg /setactive a1841308-3541-4fab-bc81-f71556f20b4a
exit
I Saved the batch file somewhere else to keep my desktop clean, I held alt down and moved the file, which created a shortcut, and cut the shortcut, pasted it to my desktop, right clicked on the shortcut > properties > shortcut tab > Advanced > to clicked “Run as administrator" > applied all changes.
This way I can switch to Power Saver mode manually anytime, but plugging in always switches back to Balanced automatically. No screen dimming or sleep settings get messed with — just the plan. I haven't checked but I assume that anything like what happens when I close lid or what happens when I press the power button or specific sleep settings might have to be matched with what balanced have.
Enjoy controlling your power plans like a pro!
This has been Truncat3d 00000000111100010100110______________end of line