/powercfg Module to sum up all the Power consumption (Battery and AC)

Guenes, Abdurrahman 5 Reputation points
2024-10-18T13:24:09.7533333+00:00

powercfg /spr /output "c:\sleepy.xml" /xml /duration 1

Is there a better way to collect all the used Powerinformation and sum the mW number?

My Goal is to collect the total Powerconsumption (Battery and AC Usage) in total. The reason behind it is to have a report for a Officelocation and their estimated Powerusage due to Clients and Computers.

After creating the "sleepy.xml" file i usually do this in Powershell:

Step 1: Load the XML file with SPR

$xmlFilePath = "C:\sleepy.xml"

[xml]$xmlData = Get-Content $xmlFilePath

$xmlData.SleepStudy.ScenarioInstances.RecentUsageInstance.SrumData.PowerEstimationData.PowerEstimationRecord.TotalPowerConsumption | Measure-Object -Sum

That gives me a number around 100k. The problem here is that the number is based on the Batteryusage only. So the Value itself is not that helpful.

But when i try this expression the result is different:

$xmlData.SleepStudy.ScenarioInstances.RecentUsageInstance.SrumData.EnergyMeterData.EnergyMeterRecord.PowerConsumption | Measure-Object -Sum

Both seem in the end too little IF they are mW results.

I hope someone can help me to find a solution where i dont have to install a program and can only use commands in cmd or powershell and/or via VBS or .bat

Thank you in advance!

A.Guenes

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} vote

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.