windows 7 - Conditionally put back computer to sleep after task finished

07
2013-09
  • Andrew

    I have a task scheduled that runs periodically every few hours. I'd like to allow it to wake computer from sleep state and based on how that task finished (perhaps based on exit code, or some other way) put computer back to sleep. Is that possible natively in Windows, or with some advanced task scheduler extension to windows? I put my computer to sleep on-demand only, so leaving it running after task finished isn't an option, as it won't put it back to sleep by itself.

    I'd be willing to write some program myself that would run after task finished, but I have no idea if Windows even report if the task woke up computer, and if you can access it programmatically somehow.

    Any advice is appreciated :)

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    power management - Why does my Windows 7 computer freeze after waking up from Sleep?
  • Questioner

    Moderator edit: if you have a similar problem, please ask your own question, since it seems there are several things that can cause this situation, it is better to treat each case separately.


    Hey guys. I have Windows 7 running on my computer and everything is perfect. There's only one little problem. Sometimes when I leave my computer, I come back and my monitor is turned off or asleep, whichever it is. This is fine, I set it to do this. However, after turning on the monitor and moving the mouse around, the mouse cursor freezes; both the keyboard and mouse don't respond to anything, for example the keyboard's windows key won't bring up the start menu and moving the mouse around does not move the cursor around on the screen. I have to wait about a minute or two before things start working again.

    I figured this was a power savings setting problem, so I went into Control Panel > Power Options.

    I only have Turn off Display => 30 minutes and Put Computer to Sleep => Never. Of course, I went into the advanced power settings to look through there. I put Never to turn off the hard disk, Sleep after never, and that's about it. Nothing else there looks like it might be causing this. I went into the device manager and checked the mouse and the keyboard, and they both have the Allow this device to wake the computer checked for both of them.

    Perhaps this other bit of information might help: Sometimes I VNC into my PC using my MacBook, and sometimes, as soon as it shows me the desktop, the same thing happens. The mouse won't move and VNC won't register any events on the server (Which is my PC of course). I close the client (And I know it has nothing to do with the client), then immediately restart it and try to connect. When I click the connect button, it hangs there, as if the PC is not responding.

    Basically it's like whenever I try to wake the computer from sleep, it does so by showing me the desktop, then it freaks out.

    Then again, I guess the computer isn't sleeping because the setting is set to 'Sleep after => Never'. I honestly don't know what's going on, would appreciate any insight. Thanks!


  • Related Answers
  • contact us

    I think the hard drives don't support Windows 7's new Power Management settings.

    I'm getting regular Blue Screens of Happiness whenever I try to "wake up" my E-Sata external hard drive. I installed the newest Intel Raid drivers (which I hope contain some updated drivers) and it's better now, but still not perfect.

    The default Power Management options in Windows 7 Beta turns off the Hard Disk after 20mins. This could cause problems when the PC comes out of sleep mode or hibernation. To work around the problem set the Power Options for the Hrd Disk to never turn off. To do this

    1. Click Start – Control Panel – System and Security – Power Options
    2. Click “Change Plan Settings” on the “Balanced (recomended)”
    3. Click “Change Advanced power settings”
    4. Under the “Turn Off Hard Disk after” option change the timing to “0″ which should set it to Never. Click Apply and OK.

    alt text