systeminformation: Missing battery DesignCapacity and FullChargeCapacity in Windows
Sorry @sebhildebrandt for another battery related issue. It’s not like I’m looking for them 🙂
Issue:
On my Dell XPS 15
I don’t get DesignCapacity
and FullChargeCapacity
. One of my clients also doesn’t have those on his newer XPS 13
as well.
My wmic
:
BatteryStatus=1
DesignCapacity=
DesignVoltage=11667
EstimatedChargeRemaining=80
FullChargeCapacity=
Possible solution:
After some research the solution that worked for me was to use PowerShell-only class to get those data:
PS C:\Users\Alex\systeminformation> (Get-WmiObject -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity
83995
PS C:\Users\Alex\systeminformation> (Get-WmiObject -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity
44232
I’m not sure how much backward compatible is this but I used those as a fallback if no data is available from wmic
and it works correctly:
exec('(Get-WmiObject -Class BatteryStaticData -Namespace ROOT/\WMI).DesignedCapacity', {'shell':'powershell.exe'})
exec('(Get-WmiObject -Class BatteryFullChargedCapacity -Namespace ROOT/\WMI).FullChargedCapacity' {'shell':'powershell.exe'}),
Environment (please complete the following information): systeminformation package version: 5.6.21 OS: Windows 10 Hardware: Dell XPS 15 9550
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 28 (28 by maintainers)
@plakak sorry! My fault … while checking my repo I just copied it … now merged the pull request, you are now official contributor and I anyway will add you as a contributor to the official docs … (already done … see https://systeminformation.io/contributors.html)
@plakak … first of all: I really have to thank you for putting so much effort to improving this!!! And secondly: I do agree, This works fine this way… I just wrote the code as like all the other parts I did in other sections 😉 But no worries. I will just take it how it is now and release a new version today. Best regards!!!
@plakak perfect. Thank you so much!!