PowerTip: Use PowerShell to Determine if a Laptop Is Running on Battery

Doctor Scripto

Summary: Learn how to use Windows PowerShell to determine if a laptop is running on battery.

Hey, Scripting Guy! Question How can I use Windows PowerShell to determine if my laptop is running on battery?

Hey, Scripting Guy! AnswerUse the Win32_Battery WMI class and look for a BatteryStatus of 1—this means the battery is discharging (in use). Here is an example using either the Get-WmiObject or the Get-CimInstance cmdlets.

Get-WmiObject Win32_Battery

Get-CimInstance Win32_Battery

 

0 comments

Discussion is closed.

Feedback usabilla icon