I am looking for a free software or configuration settings in windows 7 that detects the power events in LAPTOP(AC power off) and forces shutdown or hibernate.
Why do I need this ?
I am from Nepal and here we have more than 14 hours of load-shedding per day. And sometimes the power cuts out of schedule.
I want my laptop run as long as electricity is available (even after I go to Office in daytime - because I have VPN and remote access services to this laptop running). However, I don't want to consume battery power in daytime (when I am not directly using laptop) because, when I return back from work at evening, there might not be electricity and if laptop was running in battery power in daytime I could not use my laptop at night.
Psycogeek's link configured the following in Advanced Power Option. But I don't think this is proper solution to my question.

I am wondering if there is any utility software or settings to achieve this?
shutdowncommand (with the right parameters) to run whet the certain event is made. You can find the event ID by looking at the details of the event in the event log. – Tom Wijsman Jan 2 '12 at 5:15