I have created scheduled tasks on both a Vista and Win7 machine which wake up the machine if it is currently in a sleep state. However, if the task takes longer than the power settings are configured on the machine, the machine will return to a sleep state. It looks like this utility might be a solution, but I was wondering if there were other options.

Does anyone know of a powershell command or other utility that will prevent my machine from going into a sleep state while a task is running?

link|improve this question
feedback

3 Answers

There should be a checkbox in the options for scheduling a task. I don't have Win 7 in front of me at the moment so I can't say exactly where, just that I've used it before.

link|improve this answer
I know there is a checkbox for waking up the machine to run a scheduled task. Are you saying there is one to prevent the machine from going to sleep during the scheduled task too? – Kevin Oct 21 '09 at 21:04
I knew I forgot to check something when I went home... Last I checked, there is a box to prevent it from going to sleep while the task is running. – AnonJr Oct 23 '09 at 18:16
There's no box to prevent it from going back to sleep, but the box wake the computer to run this task also prevents the computer from going to sleep – Raystafarian Feb 5 at 2:53
The option to wake the computer does NOT prevent the computer from returning to sleep in the middle of task execution. That's what the question is all about. – kreemoweet Feb 5 at 4:19
feedback

There is a setting in Scheduled Tasks that you can check or uncheck which will cause a task or script to exit if it runs longer than the time specified by the checked setting. For example, if you have a task which wakes up your computer at 4 AM to do windows updates, virus scans, etc, the task will not finish if it takes longer than the time set for it at Scheduled-Tasks->Task.Name->Properties->Settings. If you have this time set for a shorter duration than the task needs, it may appear that the task failed to finish because the computer went into standby while the task was still running, but the real reason is that a longer time has to be set. Or the box can be unchecked so there is no time constraint at all.

link|improve this answer
feedback

In task scheduler go to properties - conditions tab - select 'Wake the computer to run this task'. In W7 this also triggers the computer to not go to hibernate if the task is running

edit- as commenters have pointed out, this bug may not be fixed. I haven't experienced it which is why I figured it was fixed, but there are reports that it wasn't fixed between vista and 7, which is what the OP indicates. Three is a thread over on Acronis with a script you can create and run with tasks that will stop the computer from hibernating. Additionally, there's a post on this website about inserting ping into your tasks to stop the computer from hibernating.

link|improve this answer
If this bug has been fixed in Win7, that's good to know, but it still occurs in Vista, which is one of the subjects of this question. – kreemoweet Feb 5 at 4:23
The Question author seems to be claiming that your assertion is not correct. Do you have a reference? – kreemoweet Feb 5 at 4:37
It works for me, but I'm on a desktop. Might just be my settings. this thread step 10 indicates that you must change some sleep return timeout settings per this method. Unfortunately, I can't find any documentation that W7 fixed this bug from vista. – Raystafarian Feb 5 at 12:05
this post has a good workaround for the bug, if it hasn't been fixed. I can't find any documentation that it has been fixed even though I don't experience it. I'll leave my answer up for reference and update it with pertinent information – Raystafarian Feb 5 at 12:19
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.