⚡ PowerShell 5.1+
Get Battery Info Report
Queries Win32_Battery via WMI and reports Battery Info in a formatted table, with an optional CSV export.
Get-BatteryReport.ps1
<#
.SYNOPSIS
Reports Battery Info on this computer via WMI (Win32_Battery).
.DESCRIPTION
Queries Win32_Battery and displays Name, EstimatedChargeRemaining, BatteryStatus, Chemistry for each item found.
Use -ExportPath to also save the results to a CSV file.
.PARAMETER ExportPath
Optional path to a .csv file to write the results to.
.EXAMPLE
.\Get-BatteryReport.ps1
.EXAMPLE
.\Get-BatteryReport.ps1 -ExportPath C:\Reports\battery.csv
#>
[CmdletBinding()]
param(
[string]$ExportPath
)
$items = Get-CimInstance -ClassName Win32_Battery | Select-Object Name, EstimatedChargeRemaining, BatteryStatus, Chemistry
if (-not $items) {
Write-Host "No Battery Info found." -ForegroundColor Yellow
return
}
$items | Format-Table -AutoSize
if ($ExportPath) {
$items | Export-Csv -Path $ExportPath -NoTypeInformation -Encoding UTF8
Write-Host "`nExported to $ExportPath" -ForegroundColor Cyan
}