In Windows Vista or Windows Server 2008, you create a task in Task Scheduler, and then you select the Wake the computer to run this task option. This option makes sure that the computer wakes up from sleep or from hibernation to run the task. In this scenario, the scheduled task wakes up the computer as scheduled. However, 120 seconds later, the operating system resumes sleep or hibernation even if the scheduled task is running. Therefore, the scheduled task is suspended unexpectedly.
Note: The issue does not occur if the scheduled task calls the SetThreadExecutionState() function.