☕ Buy a Coffee
Home / Windows & SysAdmin

Create a 'Battery Saver' Automation for When Unplugged

Automate background power plan switching to downclock CPU cores and dim display refresh rates the moment your laptop disconnects from AC power.

Sachin Siju
Sachin Siju
Lead Systems Engineer & Tech Blogger
Jul 01, 2026 4 min read
Create a 'Battery Saver' Automation for When Unplugged

Two Ways to Automate Power Behavior

Windows already reacts to being unplugged in a limited way — Battery Saver kicks in below a percentage threshold, and per-plan settings dim the screen and sleep the disk after a timeout. But if you want something more deliberate, like immediately switching to a stricter power plan the instant AC power is removed rather than waiting for a battery percentage threshold, you need to trigger an action off the power source change event itself. Windows logs that event, and Task Scheduler can react to it. This guide covers both the built-in Battery Saver configuration and the more aggressive Task Scheduler automation.

Part 1: Configuring Built-In Battery Saver

  1. Open Settings → System → Power & battery.
  2. Expand Battery Saver.
  3. Set Turn battery saver on automatically at to a higher percentage than the default 20% — 50% or even "Always" if you want it active on every unplug regardless of charge level.
  4. Under the same page, check Power mode and set it to Best power efficiency when you expect to run unplugged often — this throttles background CPU behavior and reduces performance in exchange for battery life.

Battery Saver alone reduces background sync frequency, mail push, and certain visual effects, but it won't force a CPU downclock or change display refresh rate on its own — for that you need to pair it with a specific power plan.

Part 2: Auto-Switching Power Plans on Unplug

The most reliable way to force a specific plan (and by extension CPU throttling, since power plans control processor minimum/maximum state) the instant AC is removed is a Task Scheduler task triggered directly off the power source change event, rather than waiting on a battery percentage.

Step 1: Find Your Power Plan GUIDs

Open an elevated Command Prompt and list your available plans:

powercfg /list

Note the GUID next to Power saver (or a custom plan you've created) and the one next to your normal plugged-in plan, e.g. Balanced.

Step 2: Create the "On Battery" Task

  1. Open Task Scheduler (taskschd.msc).
  2. Click Create Task (not Basic Task — you need the custom event trigger).
  3. On the General tab, name it something like "Switch to Power Saver on Unplug" and check Run with highest privileges.
  4. On the Triggers tab, click New, set Begin the task to On an event, choose Custom, and click New Event Filter.
  5. Set Log to System and Source to Microsoft-Windows-Kernel-Power, then under Event IDs enter 105 (this is the power source change event, logged every time you plug or unplug).
  6. On the Actions tab, click New, set Action to Start a program, and enter:
    Program/script: powercfg
    Arguments: /setactive <power-saver-GUID>
  7. Save the task.

Step 3: Create the Matching "On AC Power" Task

Repeat the same process for restoring your normal plan when AC is reconnected — same Event ID 105 trigger, but pointing the action at your Balanced or High Performance plan's GUID instead. Without this second task, your machine stays in Power Saver even after you plug back in.

Warning: Event ID 105 fires on every power source change — both plugging in and unplugging — it doesn't distinguish direction on its own. To avoid both tasks firing and fighting each other on every single event, filter more precisely using an XPath custom query on the Event Filter's XML tab that checks the event's AcOnline data field, or accept the simpler (if slightly redundant) approach of pointing both tasks at powercfg /setactive with mutually exclusive target plans — worst case one no-ops because you're already on that plan.

What This Won't Do: Display Refresh Rate

Power plans control CPU min/max processor state, display timeout, and sleep behavior, but Windows doesn't expose per-plan display refresh rate switching through powercfg — that's a separate setting under Settings → System → Display → Advanced display, and on most laptops with a 120Hz+ panel, dynamic refresh rate switching (if the panel and driver support it) already happens automatically based on content and power state without any scripting needed. Check Display → Advanced display → Choose a refresh rate for a Dynamic option if your hardware supports it.

Verifying the Automation Works

Unplug your laptop and check the active plan immediately:

powercfg /getactivescheme

It should report the Power Saver GUID within a second or two of unplugging. Plug back in and run it again to confirm it swaps back.

Wrap-Up

Battery Saver's percentage-based trigger is fine for casual use, but if you want power behavior to change the instant you're unplugged rather than after your battery drops below a threshold, the Task Scheduler + powercfg combination gives you that immediate, deterministic switch — and it's a one-time five-minute setup that runs silently in the background forever after.

Featured Infrastructure Partner

Deploy on High-Performance Hostinger Cloud

Get up to 75% OFF + free domain & SSL. Powering xube.me's sub-second response times.

Claim Discount ↗

Discussion & Insights

Related Technical Essays