Make PC wake up using task scheduler in Win 10 from sleep

Make PC wake up using task scheduler in Win 10 from sleep

I am trying to get my PC to wake itself up in the morning, but no luck here. I have enabled wake timers in the Windows Power Options, and selected "wake this computer" in task scheduler options.

Two Steps

Step 1

Create a batch script (example in solution part two below) that emulates keyboard key strokes. Schedule it with Windows Task Scheduler and tell it to wake up the computer to run the task at the designated time(s).

(Again, example batch script at bottom to use for scheduling along with logic native to Windows that emulates keyboard strokes (SendKeys) which will wake up the sleeping monitor.)

SOURCE: How to Make Your PC Wake From Sleep Automatically - Further Detail

enter image description here


Step 2

Use the below batch script logic to natively emulate keyboard key strokes with a dynamically built and executed VBS script with batch though. This will be the batch script to execute logic-wise as an example.

Example batch script sending space multiple times like pressing the spacebar

(You can use any other keys you need to with SendKeys as well)

@ECHO OFF
SET TempVBSFile=%tmp%\~tmpSendKeysTemp.vbs

:VBSDynamicBuild
IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
ECHO Set WshShell = WScript.CreateObject("WScript.Shell") >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"
ECHO Wscript.Sleep 500                                    >>"%TempVBSFile%"
ECHO WshShell.SendKeys " "                                >>"%TempVBSFile%"

CSCRIPT //nologo "%TempVBSFile%"
GOTO EOF

Trouble with Computer waking up from Sleep

If you've had trouble with Windows Scheduled Tasks waking up your computer when it is sleeping, then you may want to disable hibernation in case that's the cause. To do this just open Windows command prompt as administrator, type in this command POWERCFG HIBERNATE OFF, press Enter, and then restart the PC. Also see POWERCFG for more detail of this command.

Test It

If possible, you may want to test to confirm that this fixes the issue. Setup the job as specified below but set it to kick off in 2-5 minutes from the time you're ready to test. When you're ready, run this from command line (as administrator again) to put the Windows 10 machine to sleep C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0, and then just wait to see if that works.

Still Not Working

See my accepted answer here in this post related to Scheduled Task Problems. While this answer is for Windows 7, these options still apply to the Task Scheduler on Windows 10 so just look through it and ensure the options are set as indicated or where applicable and equivalent.