Get-BatteryReport
Description
Returns a system object containing all information that can be gathered by running powercfg /batteryreport.
Usage
- Set up the Report object classes.
- Attempt to get the report; if an error occurs, return nothing.
- Attempt to get the content of the exported XML report; if that fails, return nothing.
- Loop through all the data returned in the XML, formatting the system object and removing unnecessary XML tags, returning just the passed information.
- Combine into one object of objects.
- Return that object.
.\Get-BatteryReport.ps1
Returns a system object containing all data from the generated battery report.
Output
[System.Object]
    XMLNS
    ReportInformation
        LocalReportStartTime
        LocalScanTime
        ReportDuration
        reportGuid
        reportStartTime
        ReportVersion
        ScanTime
        Utcoffset
    SystemInformation
        BiosDate
        BiosVersion
        ComputerName
        ConnectedStandby
        osBuild
        PlatformRole
        SystemManufacturer
        SystemProductName
    Batteries
        Chemistry
        CycleCount
        DesignCapacity
        FullChargeCapacity
        Id
        LongTerm
        ManufactureDate
        Manufacturer
        RelativeCapacity
        SerialNumber
    DesignCapacity
        ActiveRuntime
        Capacity
        ConnectedStandbyRuntime
    FullChargeCapacity
        ActiveRuntime
        Capacity
        ConnectedStandbyRuntime
    RecentUsage
        Ac
        ChargeCapacity
        Discharge
        Duration
        EntryType
        FullChargeCapacity
        IsNextOnBattery
        LocalTimestamp
        Timestamp
    History
        ActiveAcTime
        ActiveDcEnergy
        ActiveDcTime
        BatteryChanged
        CsAcTime
        CsDcEnergy
        CsDcTime
        CycleCount
        DesignCapacity
        EndDate
        EstimatedDesignActiveTime
        EstimatedDesignCsTime
        EstimatedFullChargeActiveTime
        EstimatedFullChargeCsTime
        FullChargeCapacity
        LocalEndDate
        LocalStartDate
        StartDate
    EnergyDrains
        EndChargeCapacity
        EndFullChargeCapacity
        EndTimestamp
        LocalEndTimestamp
        LocalStartTimestamp
        StartChargeCapacity
        StartFullChargeCapacity
        StartTimestamp