This should be trivial to implement using the SystemInformation.PowerStatus property. And even though that lives in Windows.Forms, it should be perfectly usable from a system service.
For a solution that also works on the Compact Framework, see HOWTO: Get the Device Power Status