![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| | Vista - Task scheduler and sleep mode - Sleeps too soon |
![]() |
| |
| 03-30-2007 | #1 |
| | Task scheduler and sleep mode - Sleeps too soon If I create a scheduled task in Vista, set to wake the computer from sleep mode, Vista wakes correctly, but goes back into sleep mode before the task is finished. I've seen a couple of posts here mentioning similar problems, and I'm wondering if Microsoft are aware of the problem. I have the same problem on two different PCs both running Ultimate (one upgraded from XP Pro, one with Vista pre-installed). The PC wakes up correctly at the time the task is due, starts to run the task, but then goes to sleep after 1 or 2 minutes, usually before the task has ended. When it next comes out of sleep (for whatever reason) the task resumes. I've tried changing my power settings to put the PC to sleep after various time periods from 15 minutes to 2 hours, but get the same effect. It appears to happen regardless of the user the task is set to run under, and whether the task is set to run in "Vista mode" or "2000/XP mode". I've even tried to manually put the PC into High Performance mode (using powercfg) as the first step in the task (the idea being to then put it back into my standard power mode once it's finished), but it still goes to sleep within a couple of minutes and before the task ends. Doing a powercfg -l shows that the PC is in High Performance mode during the task (which, of course, is configured not to sleep). This is causing me real problems as my nightly backups aren't completing! Any ideas? Thanks. |
My System Specs![]() |
| 03-31-2007 | #2 |
| | Re: Task scheduler and sleep mode - Sleeps too soon On Mar 30, 6:54 am, "Adam" <add...@yahoo.com> wrote: > If I create a scheduled task in Vista, set to wake the computer from sleep > mode, Vista wakes correctly, but goes back into sleep mode before the task > is finished. > > I've seen a couple of posts here mentioning similar problems, and I'm > wondering if Microsoft are aware of the problem. I have the same problem on > two different PCs both running Ultimate (one upgraded from XP Pro, one with > Vista pre-installed). > > The PC wakes up correctly at the time the task is due, starts to run the > task, but then goes to sleep after 1 or 2 minutes, usually before the task > has ended. When it next comes out of sleep (for whatever reason) the task > resumes. I've tried changing my power settings to put the PC to sleep after > various time periods from 15 minutes to 2 hours, but get the same effect. > > It appears to happen regardless of the user the task is set to run under, > and whether the task is set to run in "Vista mode" or "2000/XP mode". > > I've even tried to manually put the PC into High Performance mode (using > powercfg) as the first step in the task (the idea being to then put it back > into my standard power mode once it's finished), but it still goes to sleep > within a couple of minutes and before the task ends. Doing a powercfg -l > shows that the PC is in High Performance mode during the task (which, of > course, is configured not to sleep). > > This is causing me real problems as my nightly backups aren't completing! > > Any ideas? > > Thanks. I have worked with MS support on this for 2-3 weeks. Here is the latest thing they told me: I can understand the inconvenience that this issue causes. Actually, this issue can also be reproduced on test machines at our technical support site. Therefore, we can confirm that the issue is not system specific but is related to the programs and codes. I have immediately forwarded this issue to the relevant team for further investigation. Please be assured that our developers will look into this issue and find a permanent solution. Your patience and understanding on this is greatly appreciated. So at least on some level they are aware of it. I asked if there was any way I could track the progress of the issue, but was told no, that I would be informed when a fix was available, but there was otherwise no way for me to stay up to date on the status of the investigation. So I am hopeful for a fix someday but am not holding my breath. -- bc |
My System Specs![]() |
| 04-01-2007 | #3 |
| | Re: Task scheduler and sleep mode - Sleeps too soon > I have worked with MS support on this for 2-3 weeks. Here is the > latest thing they told me: Thanks for the info. At least they're aware of the problem. A. |
My System Specs![]() |
| 12-11-2008 | #4 |
| Vista Ultimate 64 | Re: Task scheduler and sleep mode - Sleeps too soon I've always considered myself reasonably patient and understanding, but considering that I'm still plagued by this problem more than a year and a half after Microsoft confirmed that it is a problem and said that the relevant team is working on a permanent solution, I'd have hoped for a fix by now. |
My System Specs![]() |
| 12-11-2008 | #5 |
| Vista x64 Ultimate SP2, Windows 7 Ultimate x64 | Re: Task scheduler and sleep mode - Sleeps too soon I've always considered myself reasonably patient and understanding, but considering that I'm still plagued by this problem more than a year and a half after Microsoft confirmed that it is a problem and said that the relevant team is working on a permanent solution, I'd have hoped for a fix by now. This tutorial may help you fix this problem by adjusting how long you want the return to sleep time to wait for a unattended wakeup until returning to sleep automatically. Sleep Return Timeout for Unattended Wake Up Hope this helps, Shawn |
My System Specs![]() |
| 01-07-2009 | #6 |
| Vista Ultimate 64 | Re: Task scheduler and sleep mode - Sleeps too soon Thanks for the link to the tutorial. I've solved the problem by going a different route. Since I've written the program that I'm running under Task Scheduler myself using Visual Basic I used the "SetThreadExecutionState" API to keep the computer awake long enough to execute the program. It took a lot of experimentation to figure out how to declare and use the API properly since the documentation for it is in C++, with which I am unfamiliar. In case I can help someone else avoid the frustration, here's what works: Declare Auto Function SetThreadExecutionState Lib "kernel32.dll" (ByVal esFlags As Long) As Long Public Sub Main() SetThreadExecutionState(&H80000001) ' parameter is the hexadecimal sum of the ES_CONTINUOUS and the ES_SYSTEM_REQUIRED flags ' rest of program goes here SetThreadExecutionState(&H80000000) ' parameter is the hexadecimal value of the ES_CONTINUOUS flag End Sub Task Scheduler now wakes the computer up to run the program, it stays awake as long as required to complete the program, then goes back to sleep when finished. |
My System Specs![]() |
| 01-07-2009 | #7 |
| Vista x64 Ultimate SP2, Windows 7 Ultimate x64 | Re: Task scheduler and sleep mode - Sleeps too soon You're welcome TNSpearman. I'm happy to hear that you got it sorted. Shawn Thanks for the link to the tutorial. I've solved the problem by going a different route. Since I've written the program that I'm running under Task Scheduler myself using Visual Basic I used the "SetThreadExecutionState" API to keep the computer awake long enough to execute the program. It took a lot of experimentation to figure out how to declare and use the API properly since the documentation for it is in C++, with which I am unfamiliar. In case I can help someone else avoid the frustration, here's what works: Declare Auto Function SetThreadExecutionState Lib "kernel32.dll" (ByVal esFlags As Long) As Long Public Sub Main() SetThreadExecutionState(&H80000001) ' parameter is the hexadecimal sum of the ES_CONTINUOUS and the ES_SYSTEM_REQUIRED flags ' rest of program goes here SetThreadExecutionState(&H80000000) ' parameter is the hexadecimal value of the ES_CONTINUOUS flag End Sub Task Scheduler now wakes the computer up to run the program, it stays awake as long as required to complete the program, then goes back to sleep when finished. |
My System Specs![]() |
![]() |
![]() |
| Thread Tools | |
| |
Similar Threads for: Task scheduler and sleep mode - Sleeps too soon
| ||||
| Thread | Forum | |||
| Vista Sleep Mode and Task Scheduler | Vista General | |||
| Task scheduler and sleep; sleeps too soon | Vista General | |||
| Task Scheduler wakes up, but goes back to sleep | Vista General | |||
| Vista Sleep Mode: Monitor Sleeps, PC...not so much | Vista performance & maintenance | |||
| Vista - Sleep/network/task scheduler issue | Vista General | |||