Comments

10 comments

  • Luke Nichols

    Joshua,

    You could probably do a WMI query for the Win32_Battery class. See this Microsoft doc for more info:

    https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-battery

    Of course, you'd have to set up a new WMI or PowerShell scanner in order to harvest the data.

    1
    Comment actions Permalink
  • Joshua Campbell

    Luke,

    I tried that on a laptop with a good battery and on one with a bad battery.  On both the "Status" came back as OK and the BatteryStatus came back as 2 (that is, "unknown" per https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-battery).  But, I guess now I wonder whether the battery information is actually accurate when powered by AC.  And if that is the case, then it is going to get a little harder to make sure users' laptops have healthy batteries.

    1
    Comment actions Permalink
  • Colby Bouma

    Have you tried this PowerShell Scanner? https://github.com/pdq/PowerShell-Scanners/tree/master/PowerShell%20Scanners/Battery%20Status

    1
    Comment actions Permalink
  • Joshua Campbell

    Hi Colby.  No sir, I cannot say that I have tried that.  Would it help me accurately determine if the battery is unhealthy?

     

    And, I just realized that I did not define what I meant by "unhealthy".  I am trying to find if a battery will no longer last more than say 60 minutes after a full charge and therefore needs to be scheduled for replacement.

    1
    Comment actions Permalink
  • Colby Bouma

    It calculates Health as full charge divided by designed capacity, so it might be close. https://github.com/pdq/PowerShell-Scanners/blob/master/PowerShell%20Scanners/Battery%20Status/Battery%20Status.ps1

    2
    Comment actions Permalink
  • Joshua Campbell

    OK, I'll take a look at it and see what I can do.  I've never used one of your scanners.  Do I just save the script and then add that to a Scan Profile in PDQ Inventory?

    1
    Comment actions Permalink
  • Colby Bouma

    That'll work, but the best way is outlined in the main README: https://github.com/pdq/PowerShell-Scanners/blob/master/README.md

    1
    Comment actions Permalink
  • Joshua Campbell

    Thank you Colby. 

    I imported the scan profile and executed it against a laptop that I recently replaced the battery (known good), a laptop that I need to replace the battery (known bad) and then a random laptop.  The results look very promising and I think that I can use this as a metric to try to predict when we might need to make sure we have a replacement battery on hand.

    1
    Comment actions Permalink
  • It

    I really like this software. Was playing around with this scanner, and figured out how to configure the trigger so it will update when data is more than three days old, and only link it to the laptop OU from AD so it's not trying to run on all our desktops and servers. Just when you think you're starting to learn the ins and outs, you discover a new layer of usefulness.

    0
    Comment actions Permalink
  • Michael Yorke

    Hi, I just signed in to say how brilliant the script is - thanks so much.
    I had a user contact me recently saying his laptop doesn't last very long when running on battery, so I ran a health report - it was less than 5% capacity! I wondered how many other laptops were in this state, so began to look up how I could use powershell to extract this info - it looked daunting.

    ... so I add "PDQ" to my googling, and what do you know, PDQ are one step ahead. Awesome work Colby.

    0
    Comment actions Permalink

Please sign in to leave a comment.