Since you are using an UPS from APC I would like to suggest to use "apcupsd".
Here comes a snip from the manual of apcupsd (
http://www.apcupsd.org/manual/manual.html)
(which is written having the Linux version in mind, but most things work similar on the Windows version!):
==========================
==========
==========
==========
======
"Apcupsd Notification and Events:
When a major event is generated within apcupsd, control is passed to the script apccontrol normally found in /etc/apcupsd/apccontrol. The event name, and a number of other important parameters are passed to the script.
The major function of the apccontrol script is to perform a shutdown of the system (as well as the killpower operation). In addition, another major task for this script is to notify you by email when certain events such as powerfail occur.
Since apccontrol is a script, you can customize it to your own needs using any text editor. To do so, you must have a minimal knowledge of Unix shell programming. In addition, another feature is that you can write your own scripts that will be automatically called by apccontrol before any of its own code is executed. Details of the events and how to program them are contained in the Advanced topics section entitled Customizing Event Handling."
Background info about apcupsd
==========================
Should you not know apcupsd, here some background information for you:
apcupsd (= APC UPS Daemon) is a open source project which originally added support vor APC UPS for Linux, but since a couple of years the tools has beeing enhanced to fully support MS Windows, too.
In the last years I have worked with the original "APC Powerchute" software, with the APC network interface cards and with apcupsd.
apcupsd is IMHO by far the best solution - yes, even better then the APC network cards!! - and I would never use something else anymore.
I am using it in my heterogeneous Linux-Windows networks now since approx. 9 years without any problems, having apcupsd work as a server on the computers to which the UPS is connected via the data cable and having apcupsd work as the correspondent clients on the machines in my network that are connected to the ups power and should be shut down, too, in a power event.
You will find it here:
www.apcupsd.orgHTH
Tom