A PowerShell script that checks your laptop's battery health and life using Windows' built-in battery report (powercfg /batteryreport) — the tool Microsoft officially recommends for this.
- Runs
powercfg /batteryreportto generate the official HTML battery report. - Parses the report to extract:
- Design Capacity — the battery's capacity when new
- Full Charge Capacity — its current maximum capacity
- Cycle Count (if available)
- Battery life estimate — "since OS install", at full charge and at design capacity
- Calculates battery health % = Full Charge Capacity ÷ Design Capacity.
- Prints a color-coded summary to the console and opens the full HTML report in your browser.
- Windows 10/11 with a battery (laptop or tablet)
- PowerShell (built in — no modules needed)
- No admin rights required
powershell -ExecutionPolicy Bypass -File .\BatteryHealth.ps1Or, from an existing PowerShell session:
.\BatteryHealth.ps1===== Battery Health Report =====
Design Capacity: 32,560 mWh
Full Charge Capacity: 26,625 mWh
Battery Health: 81.8%
Estimated battery life (since OS install):
At full charge: 2:41:38 (h:mm:ss)
At design capacity: 3:17:40 (h:mm:ss)
Full HTML report saved at: C:\Users\<you>\AppData\Local\Temp\battery-report.html
Opening report in default browser...
- 🟢 Green: health ≥ 80%
- 🟡 Yellow: health 50–79%
- 🔴 Red: health < 50%
Windows' battery report HTML sometimes inserts a line break inside table cells (e.g. 32,560 mWh followed by a newline before the closing </td>). The script's regex patterns are written to tolerate that — they match on "any character that isn't a tag" rather than the more common (but newline-blind) . wildcard, so parsing stays reliable across different Windows builds/locales.
- Only reads the primary/first battery if multiple are listed.
- Cycle count isn't reported by all hardware/firmware — Windows will show
-in that case. - Battery life estimates are based on your own historical usage, not a fixed benchmark, so they'll vary with how you use the device.
MIT — do whatever you like with it.