Win7 SP1 not returning to sleep after scheduled tasks

Discussion in 'Windows 7 Help and Support' started by proteus459, Jun 23, 2013.

  1. proteus459

    proteus459 Well-Known Member

    Joined:
    Aug 21, 2011
    Messages:
    90
    Likes Received:
    2
    Within the past month or so I've noticed that my Win7 SP1 desktop has stopped returning to sleep after the task scheduler runs any one of the 3 scheduled tasks for which "wake the computer..." is set as a condition. I put the system to sleep each night with "defrag", "restore" and "backup" set to run in the pre-dawn hours of the mornings or 3 different days. For the two years since the system was built, the tasks ran as scheduled and I found the system in sleep mode the morning after each one ran. But a few weeks ago I noticed that the system was already awake each morning when I arrived. I can not think of anything that might have been done to cause the change in behavior; the triggers and conditions for each of the 3 tasks are unchanged. I'm hoping that there is some minor adjustment that will correct the system's behavior.
     
  2. kemical

    kemical Windows Forum Admin
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    Aug 28, 2007
    Messages:
    31,834
    Likes Received:
    1,566
    Hi,

    try checking the event viewer to see if anything is awry. Failing that have you tried clearing the schedules and recreating them again?
     
  3. proteus459

    proteus459 Well-Known Member

    Joined:
    Aug 21, 2011
    Messages:
    90
    Likes Received:
    2
    Hello...

    I will have someone more knowledgeable than I look at the event viewers but I know that no hardware is involved as none has been added changed that might be waking the system.

    As for the tasks themselves I have disabled and reenabled both backup and restore and scheduled them to run while the computer is awake by removing the condition to wake the computer and changing the day and time of the task. They both ran properly. I changed them both to run while the computer was asleep but removed the condition to wake the computer. Both remained asleep all night and ran as soon as the computer was awakened manually in the morning. Both ran properly. Is that what you mean by "clearing the schedules"?
     
  4. kemical

    kemical Windows Forum Admin
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    Aug 28, 2007
    Messages:
    31,834
    Likes Received:
    1,566
    What I meant was that sometimes in Windows settings can become a little corrupted. Sometimes if one removes the settings altogether and then recreate them the issue can be resolved. Judging from your above post you've found a way round your issue?
     
  5. proteus459

    proteus459 Well-Known Member

    Joined:
    Aug 21, 2011
    Messages:
    90
    Likes Received:
    2
    Specifically which settings would you remove and what would you do immediately after removing them to make the computer ready to accept new settings? Just restart the computer?
    Well, not really. My goal is to have the tasks run during the night while the computer is no in use. I would prefer to place the system in sleep mode and have the task scheduler wake it to run the task and then return it to sleep. This is important to me because I am often away the from the system for a week or two and do not want to leave the system running for 2 weeks if I don't need to. Yes, the tasks will run if I schedule them to run during the day during the day and they will run immediately upon waking if schedule them for night time but do not wake the computer to run them. But either way, I do not have the system I had a month ago that wakes up to run a task and then returns to sleep.
     
  6. kemical

    kemical Windows Forum Admin
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    Aug 28, 2007
    Messages:
    31,834
    Likes Received:
    1,566
    I would simply try setting the schedules up again after deleting them. If the system still fails to work as it should then you have to find the cause. One way would be to view the event logs which are accessible through the control panel and admin tools.
    A windows install can degrade over time and you could try restoring the pc back to an earlier time or try to repair the current install. You can do this by running the system file checker. Right click on command prompt and click run as admin, then type:

    sfc /scannow

    Press enter and await results..

    Other things you could check for are your network adapter can also wake the pc, see the screenshot on how to turn this off:

    wake up.

    To be honest though checking the event viewer will give you a better idea. I know you don't think you could decipher it but honestly just have a look and remember that google is your friend. If you see something you don't understand then google it or ask here. To be honest that's how many of us started here by just simply having a go yourself. As i said, don't worry, if there's something you don't understand we will help.
     
  7. proteus459

    proteus459 Well-Known Member

    Joined:
    Aug 21, 2011
    Messages:
    90
    Likes Received:
    2
    I appreciate your time and suggestions. My IT fellow is coming today. He has built me a new Win8 all-in-one system and is ready to install it. He has always preferred that I keep my black thumb out of the works so I will present him with your observations and ideas. It has to be something that is effecting the PC rather than the task scheduler since the system does not return to sleep after any yask that requires it to wake. I will let you know if he finds anything.
     
  8. kemical

    kemical Windows Forum Admin
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    Aug 28, 2007
    Messages:
    31,834
    Likes Received:
    1,566
    Ok, good luck and do please keep us updated.. :)
     
  9. Saltgrass

    Saltgrass Excellent Member
    Microsoft Community Contributor

    Joined:
    Oct 16, 2009
    Messages:
    15,157
    Likes Received:
    393
    I suppose a couple of things come to mind. You do not mention you had disabled the defrag task... Did it leave the system needing to log in when you woke it before?

    What time of morning are you running these tasks and have you checked your power settings to make sure the sleep time is still set where you want?

    I suppose you have disabled the tasks and then tried running just one at a time to see if you can find which one might be involved? Have any other tasks been added, like Media Center updates? If you now suspect it is a system problem, then I suppose this will not help.

    Have your tried the powercfg -lastwake command to see what woke the machine? The powercfg command can give some info regarding power related issues, like sleep. Use powercfg -help to see the switches, and maybe run the powercfg -energy command and copy the resulting report to the desktop to check it.

    In some cases, other computers can keep a system awake. Do you have any others that are awake at the times involved?
     
  10. proteus459

    proteus459 Well-Known Member

    Joined:
    Aug 21, 2011
    Messages:
    90
    Likes Received:
    2
    The fellow that build/maintains my system (Jeff) says that I can not have been seeing what I think I'm seeing since


    • I have the sleep timer in "power options" set to "never" to keep the computer from dosing off during the day and
    • there is nothing he is aware of in the task scheduler settings that could return a system to sleep mode once it has be awakened to run a task since I have the power settings sleep timer set to "never"

    There are 4 tasks that I prefer to have run when I'm not using the system :defrag, backup, restore point and MSE scan. He suspects that the 4 tasks I have set to wake the computer to run have actually been running after I wake the system in the morning which I what I want to avoid. The MSE scan timer will not wake the computer so Jeff wrote a task to wake the system to run an MSE scan during off hours

    Jeff has now run remotely all the checks you suggested. Results show that the system was awakened by the task scheduler and shows nothing that would indicate that anything unusual had kept it from returning to sleep afterward. He has turned off "Hibernate" and written a command line prompt that will return the system to sleep after each of my 4 tasks have been run and added it to the "actions" tab of each task (I know WHAT he did but not necessarily WHY):

    rundll32.exe powrprof.dll,SetSuspendState 0,1,0

    I will be turning off the system today and it will be until next Wednesday before I know the results of this action.
     
  11. proteus459

    proteus459 Well-Known Member

    Joined:
    Aug 21, 2011
    Messages:
    90
    Likes Received:
    2
    The run command works exactly as hoped...the system wakes from sleep to run the selected scheduled tasks and then promptly returns to sleep state.

    rundll32.exe powrprof.dll,SetSuspendState 0,1,0

    If any one has an interest, he expanded the task library under Windows in the left side bar of the scheduler, clicked a task to display it, right-clicked the task information in the top panel of the screen, selected "properties" >> "actions" >> "new", entered rundll32.exe in the "script" window and the remainder of the command in "arguments". (The entire command can also be entered in "script" and the answer "NO" selected for the dialog that appears.) The run command will now appear as an additional action in the task and will be executed after the task has been run.
     

Share This Page

Loading...