I have a scheduled task which I want to run every few hours. If the computer is currently in standby, I want it to wake up, run the task, then go back to sleep. If the computer is currently on, I want it to run the task but not go back to sleep, because that would be annoying.
Is there any way of knowing whether a scheduled task had to wake the computer to run?
I've just realised one way of doing it which is to run
powercfg -lastwake
This is the output when waking to run a task:
This is the output normally: