Power Mgmt: Is there a way to Shutdown after idle time period?


  1. Posts : 730
    Windows XP Pro SP3, Windows 7 Pro 32-bit, Windows 7 Ultimate 64bit, Windows XP Home SP3
       #1

    Power Mgmt: Is there a way to Shutdown after idle time period?


    friends
    I have a rig I use occasionally, as HTPC and occasional mule work, file service, etc.
    I would like to not have it simply sleep when I have left it running and not returned, but rather have it shutdown properly.
    Is there a way to do this within win7 controls, or is there an aftermarket, shareware, or scripting way to do so?

    thx
    z
      My Computer


  2. Posts : 11,269
    Windows 7 Home Premium 64 Bit
       #2

    Create a batch file and link to it with Windows Task Scheduler and have the scheduler run whenever the computer has been idle for xxxx seconds/minutes.

    In the batch file:
    shutdown /s /t 300

    Shuts down the computer in five minutes forcing all applications to close. You can change it to less time if you want. 300 seconds is five minutes arbitrarily chosen.
      My Computer


  3. Posts : 11,269
    Windows 7 Home Premium 64 Bit
       #3

    To create a batch file:
    1. Click Start Menu
    2. Click All Programs
    3. Click Accessories
    4. Click notepad
    5. save as sd.bat (change "save as type: All Files") within the Users\myusername\Documents folder (myusername is your user name you login under)
    6. Type shutdown /s /t 300 (or however many seconds you want greater than 0)
    7. save the batch file.

    Now we need to link to it using task scheduler:
    1. Click Start Menu
    2. Type "Task Scheduler" (without quotes) into the Search programs and files (do not hit enter)
    3. Right click on Task Scheduler and select Run as administrator
    4. Click Action -> Create Task...
    5. Type name as sd.bat
    6. Choose whether to run whether user is logged on (do not check the Do not store password box if you want the task to run when the user is not logged in)
    7. Put tick next to Run with highest privileges (this setting may cause the task not to save, so uncheck if you have issues at the end of these steps)
    8. Configure for Windows 7
    9. Click the Triggers tab
    10. Begin the task: On Idle
    11. Make sure a check is in the Enabled box.
    12. Hit OK
    13. Click the Actions tab
    14. Action: Start a Program
    15. Browse for sd.bat
    16. Click OK
    17. Click the Conditions tab
    18. Start the Task if the computer is idle for (However long you want to wait for it to shutdown without a user using the computer).
    19. Wait for idle for: Do not wait
    20. Stop if the computer ceases to be idle (if you want the user to have a chance to stop the shutdown).
    21. Set up the power settings as you would like
    22. Click the Settings tab
    23. Set the settings to your liking. (If you have questions, just ask)
    24. Hit OK
    Last edited by writhziden; 28 Dec 2011 at 13:00. Reason: Changed Task Scheduler opening
      My Computer


  4. Posts : 730
    Windows XP Pro SP3, Windows 7 Pro 32-bit, Windows 7 Ultimate 64bit, Windows XP Home SP3
    Thread Starter
       #4

    terrific;
    I'll give it a shot writh.
    gracias
    [ps on that failed HDD - I haven't given up. will be posting back an update]
    z

    writhziden said:
    Create a batch file and link to it with Windows Task Scheduler and have the scheduler run whenever the computer has been idle for xxxx seconds/minutes.

    In the batch file:
    shutdown /s /t 300

    Shuts down the computer in five minutes forcing all applications to close. You can change it to less time if you want. 300 seconds is five minutes arbitrarily chosen.
      My Computer


  5. Posts : 11,269
    Windows 7 Home Premium 64 Bit
       #5

    Change step 10 as follows:

    10. Begin the task: On Idle -> Begin the task: At system startup.

    Delay task for 15 minutes.

    Have it repeat the task every 15 minutes for a duration of indefinitely (in case the user stops the task).
      My Computer


  6. Posts : 1,653
    Windows 10 Pro. EFI boot partition, full EFI boot
       #6

    Or I believe you can use the task scheduler to run the script when it receieves a kernel-power event, Event ID 42 (system is entering sleep state)

    Schedule, on an event, Log: system, source: Kernel-Power, Event ID: 42.

    I think it should work without complications.
      My Computer


  7. Posts : 5,642
    Windows 10 Pro (x64)
       #7

    Why not just have the computer go into hibernation? No need for task scheduler or batch scripts that way. And you don't run the risk of shutting down when you should not. Hibernation fully shutdown the computer, it just happens to save the current state on the HDD before it does.
      My Computer


  8. Posts : 1,653
    Windows 10 Pro. EFI boot partition, full EFI boot
       #8

    logicearth said:
    Why not just have the computer go into hibernation? No need for task scheduler or batch scripts that way. And you don't run the risk of shutting down when you should not. Hibernation fully shutdown the computer, it just happens to save the current state on the HDD before it does.


    Or hybrid sleep mode. Best of both worlds.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:56.
Find Us