Use Windows PowerShell to Check Your Laptop Battery

As I get older I enjoy tripping over and untangling wires less and less. I don’t know what it is. After years of playing and recording music and using tools and instruments that need to be plugged in to an outlet, I am really enjoying the proliferation of devices that can be used without being plugged in. I am unapologetically walking around with Bluetooth earbuds. My DeWalt Li-ion drill/impact set is one of the greatest tools I’ve ever owned, and I hope to one day have zero wires. I am aware that batteries cause lots of pollution and hazardous working conditions and require rare-earth metals. I want to make my batteries last. That means I have to get good at batteries.

So why do so many people have laptops that can’t be away from the wall for more than five minutes? The simple answer is: the battery. (The more complicated answer is “the user,” but I’m not going to go through all the problems with that right now.) Modern laptops have Lithium-ion batteries that wear out over time, and will wear out faster if they are not maintained properly. Read the booklet. Every computer comes with one.

If you have a battery that doesn’t last as long as it used to there is a quick way to generate a report all about your battery using Windows PowerShell. Anyone who is curious about PowerShell but is unsure what it is or what to do with it could try this as a practice exercise. It is super easy and you aren’t going to break anything.

Open up a PowerShell window by pressing the Windows key and “x.” Select “Windows PowerShell” from the menu. This is PowerShell. It is kind of like command prompt, except its blue and you can do tons of scripting and other stuff. Stuff that I don’t know.

Type the command

powercfg /batteryreport

This will return something like

Battery life report saved to file path C:\Users\wrongtree\battery-report.html

I think if you are in an elevated (admin) PowerShell session it may save to a different location, but in this case you can just open File Explorer to your user folder and look for a file called “battery-report.html.”

Screenshot (13)
Windows PowerShell, kind of like Command Prompt, but blue and there’s scripting and stuff.

There is a lot of info in this report, some of which I find confusing or incomplete. I have had some weird power-on issues on this laptop (that’s here), possibly related to the replacement battery I installed when I inherited this machine. The figures I am looking at are the “design capacity” and “full charge capacity” numbers. Design capacity is how many mWh (milliwatt hours) your battery has the capacity to hold. This is the maximum life you can expect out of your battery when it is completely new.Full charge capacity is how many mWh your battery can hold now. When you’re down below half the design capacity you are going to start getting frustrated with how short your battery life is.

Recent battery usage chart generated in Windows PowerShell
Battery Report Usage Chart

There are also usage charts and history, detailing the life of the battery. Mine looks a little weird, like there is some data not being recorded.

Maybe this usage chart would be helpful if you’re trying to prove that a laptop was charged at a certain time on a certain day? Like if you’re a detective and have a really boring office mystery to solve. Terrible.

Here’s my battery report in a Google doc. Feel free to comment on how exciting these battery reports are.

Okay, enjoy.


Learn Windows PowerShell in a Month of Lunches
Powershell: The Quickstart Beginners Guide
Mastering Windows PowerShell Scripting - Second Edition: One-stop guide to automating administrative tasks
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.