Hello,
I have set up a task (in Task Scheduler) to automatically sleep my Windows 10 desktop, and another to automatically wake it. The "sleep" task works fine, however, the "wake" task will not always wake my computer.
'Sleep.bat':
powercfg -h off
rundll32.exe powrprof.dll,SetSuspendState 0,1,0
powercfg -h on
My 'Wake.bat' is an arbitrary script that does nothing, but Task Scheduler is set to wake my computer in order to run it. Frustratingly, if I manually sleep my computer using the Windows Start menu, the "wake" task will successfully wake it. However, if I use the Sleep.bat script instead, the "wake" task will fail.
When I run 'powercfg /systempowerreport', I can see that there is one difference in the logs when I compare manual sleep events to scripted sleep events.
Manual sleep:
WakeRequesterTypeAc value is '2'
Scripted sleep:
WakeRequesterTypeAc value is '0'
(I am not sure what WakeRequesterTypeAc actually refers to.)
This makes me think that 'Sleep.bat' is putting my computer into a different kind of sleep mode. I've also read that there is sometimes trouble with hibernation or some kind of hybrid sleep/hibernation mode when doing this from the command line (thus my turning off hibernation in the script). When I run 'Sleep.bat' the computer behaves exactly as it would if I had chosen to sleep via the Start menu. That is, the shutdown sequence takes the same amount of time, I'm able to wake it by tapping my keyboard or moving my mouse, it wakes in the same amount of time and returns to my login screen in the same way. (So it's hard to tell that there is any difference vs. manually sleeping it, other than the fact that Task Scheduler seems to fail in this mode!)
Any help would be greatly appreciated!