This is a follow-up to How do I determine logon/logoff times in Windows Powershell without admin rights?
I learned recently how to schedule tasks with Windows' Task Scheduler, and I was able to schedule a task that runs on log on and log off events.
However, I incorrectly assumed that putting a laptop to sleep would be "folded in" to the log off event. Trial of my on-logoff-task shows that it successfully runs when I explicitly lock my laptop (e.g. Win+L), but it does not run when I put my laptop to sleep.
Scheduling a task before sleep in Windows 7 and hold off the sleep event until task runs led me to learn about the PBT_APMSUSPEND event, which seems like what I need, but I can't figure out how to select that as my trigger in Task Scheduler. Can a knowledgeable user please advise what I need to do in the Task Scheduler/Edit Trigger GUI to create a task that runs on the PBT_APMSUSPEND event?
