Hey, possibly our new tool can help with that problem...
It´s not a script, but a standalone software, currently in the state of Beta-Testing. We use it exactly for this issue with our own clients.
The software won´t work with free VMWare versions, and it´s "special" concerning APC UPSs (they block with their own drivers the access to the charge condition of the battery, so you have to restore original windows drivers, which is a very easy thing to do, but you can´t use APC software parallel to ours)
If you are interested, you can find a free full working version here: www.opmonis.de/en/downloads
Criticism, suggestions and any feedback are welcome!