Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

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

$
0
0

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

 


Viewing all articles
Browse latest Browse all 3333

Trending Articles