I looked at the Test-Battery function and at first I thought this would work.
Alas all it really does is answer if you are on AC Power ($true) or not ($false).
If does fetch BatteryChargeStatus, BatteryLifePercent, BatteryLifeRemaining, BatteryFullLifetime but it puts those values in function-scoped variables. So the function ends and those variables disappear.
So I copied the battery code out and it seems to help some what but not quite.
How can you tell a workstation from a laptop on AC without batteries?