The Thinkvantage Power Manager COM object.

If you have IBM/Lenovo Thinkpad Laptop with Thinkvantage Power Manager installed you can use the PWRMGR object to check the battery status, charging progress, remaining time and also change the screen brightness.
This is undocumented method, probably you can't make any damage on your hardware, however use it at your own risk.
These examples were tested on Thinkpad T60 with windows 7.

First, let's get the list of avaliable objects:

gwmi win32_classiccomclasssetting | ? { $_.InprocServer32 -like '*PWRMGR*' } | select VersionIndependentProgId

We will work with PWRMGR.Slider and PWRMGR.Battery.
Next, let's create a new instances and check avaliable methods and properties:

$slider = new-object -com PWRMGR.Slider
$battery = new-object -com PWRMGR.Battery

$slider | gm
$battery | gm

and now the cool part, unplug the power cable from your laptop and execute following commands :


as you can see we have an informaiton about the remaining percentage and time (which are the same as on the taskbar), Plug back the power cable and run these commands:


this time we've got the charging time, also the ChargeStatus was changed, you can use this function to detect if your laptop is on battery or not.
It's important to execute Update() method to get the current values before you check any property.

And the last cool trick is changing the screen brightness, this time we'll use PerformBrightnessSimulation from PWRMGR.Slider object.

.. (step by 10)

Of course I didn't exhaust the subject, these was only few things that I found exploring that object.

If you prefer Python as your scripting language you can use pywin32 to work with the COM objects.

import win32com.client
battery = win32com.client.Dispatch("PWRMGR.Battery")


Post a Comment