Is there a way to have Windows 11 immediately notify me with a great big popup the instant my laptop gets unplugged? I’ve tried searching for this but all the hits are for how to turn on a battery saver mode when the battery gets low. I need something that triggers the instant it gets unplugged and can’t be easily overlooked.
You can probably do it with Task Scheduler… the basic principle of Task Scheduler is that when an “event” is triggered by the operating system, your “action” is performed.
I’m not sure if Windows 11 triggers an event when the laptop is unplugged, but I don’t think it does. This post on SuperUser has a PowerShell script you can run to add such an event.
New-EventLog -Source BatteryStatusMonitor -LogName Application
Function OnBatteryStatusChange ($NewStatus) {
If ($NewStatus -eq 1) {
$EventID = 5001
$Message = "The computer was unplugged."
} ElseIf ($NewStatus -eq 2) {
$EventID = 5002
$Message = "The computer was plugged in."
} Else {
$EventID = 5000
$Message = "Battery status changed to $NewStatus"
}
Write-EventLog -LogName Application -Source BatteryStatusMonitor -EventID $EventID -Message $Message
}
$Query = "select * from __instancemodificationevent within 3 where targetinstance isa 'win32_battery' and targetinstance.batterystatus <> previousinstance.batterystatus"
Register-WmiEvent -Query $Query -Action {OnBatteryStatusChange $Event.SourceEventArgs.NewEvent.TargetInstance.BatteryStatus} -SourceIdentifier "BatteryStatusChange"
For (;;) {}
After you’ve registered your custom event, you can follow the steps below to associate it with a popup message. (Instead of choosing startup as the trigger, choose custom event, and change the event ID to 5001 - the unplug event ID as defined in the above script)
- Open the task scheduler by searching for “Task Scheduler” in the start menu.
- In the task scheduler, click on the “Create Basic Task” option appearing on the right sidebar.
- Now, enter a new title and description for the task and click on the “Next” button.
- [see above]
- After selecting a proper trigger, select “Start a program” option and click “Next”.
- Program/Script —
powershell
Argument — Enter the below command-WindowStyle hidden -Command "& {[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('Relace_With_Your_Message','Message_Title')}"
Don’t forget to replace “ Replace_With_Your_Message ” with your actual message and
“ Message_Title ” with a title. The title appears on the window title bar.Click the “Next” button to continue.
- In the Summary window, click on the “Finish” button to complete the task creation process.
~Max
I’m not familiar with Windows 11, but with previous versions you could set special modes of operation for Battery vs Plugged-in . Some of those choices usually concern screen brightness.
On my corporate Windows 10 laptop, I can do :
- Open Settings
- Select System
- Select “Power & sleep”
- Click “Additional power settings”
- Select the currently active plan and then click “Change plan settings”
- Click “Change advanced power settings”
Then I end up in a small retro-style dialog box called “Power Options”. I can select my video processor (“Intel(R) Graphics Settings” in my case), and under “On battery”, I can select “Maximum Battery Life”.
If all goes well, the result of all this should be that your screen will get noticeably dimmer the moment the brick is unplugged.
Thanks for the eventual responses, everybody. I had forgotten about this thread, otherwise I would have given it a bump a lot sooner.
This has been substantially changed and rearranged in Windows 11. Turns out I’d already fiddled with these settings as they exist now to get it very close to what you recommended, but my external monitor does not dim when the laptop goes into power saving mode.
There apparently is no longer a choice to put it in a power saving mode immediately upon switch to battery; instead I have to wait till it falls to 95% at most. Which would be fine if my external screen would dim dramatically, but it doesn’t.
I’m going to give @Max_S 's solution a try, but that’s a lot more involved.