Possible Duplicate:
Is there any way to execute something when closing the laptop's lid?
I have a task that I want to run right before my computer sleeps or hibernates. Is there a way to schedule a task for this in the Windows 7 task scheduler?
The closest that I can see is for on locking the workstation, and this works as a surrogate, but I really don't want it to run on locking unless it is also sleeping/hibernating. Is there a way to schedule for an event like this?