PowerTip: Use PowerShell to Determine if a Laptop Is Running on Battery
Summary: Learn how to use Windows PowerShell to determine if a laptop is running on battery.
How can I use Windows PowerShell to determine if my laptop is running on battery?
Use 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.