Windows 10 Sleeps Before Set Time












29















My computer is falling asleep outside of the screen and sleep times that I have set. I have made sure that the screen saver is set to none, and that the power options and advanced settings match the sleep settings. Regardless, though I have set sleep to 1 hr, it will go to sleep after approximately 2-4 minutes. If I reboot, this will solve the problem temporarily until the computer sleeps normally or I initiate sleep. After that it reverts to the abbreviated sleep mode. This started happening after I installed Windows 10. Additionally, I'm using a wireless mouse and keyboard (Microsoft & Logitech) that I have turned off the "allow this device to wake your PC" option, but the same thing happens.



This computer was made by a third party, but I checked through the command line, and the motherboard is an Intel Desktop DP55WB Media Series microATX.



Any clues as to where I should start looking?










share|improve this question

























  • It would help if you would indicate the computer type and model you are talking about. even desktop motherboards can have some software that works with or changes the power plans. superuser.com/questions/984881/… a Question similar to this was asked.

    – Psycogeek
    Dec 29 '15 at 1:34











  • I don't have a make and model, but I figured out the motherboard and added it to the question. Hopefully that helps.

    – user2168046
    Dec 29 '15 at 3:13






  • 1





    check also these older ones superuser.com/questions/556883/… & superuser.com/questions/124772/… because they at least have answers, and things to look for even if it is the older os. Another idea would be to create your own custom power profile starting with whatever they call a high performance one, that will place a new item in the registry, and start with a no sleep type of profile. Check to see what power profile is applied when it occurs

    – Psycogeek
    Dec 30 '15 at 4:01








  • 1





    @Facebook Awarding existing answer

    – Martheen Cahya Paulo
    Sep 28 '17 at 20:38






  • 1





    @MartheenCahyaPaulo thanks for the bounty that was a pleasant surprise :)

    – User
    Oct 4 '17 at 16:07
















29















My computer is falling asleep outside of the screen and sleep times that I have set. I have made sure that the screen saver is set to none, and that the power options and advanced settings match the sleep settings. Regardless, though I have set sleep to 1 hr, it will go to sleep after approximately 2-4 minutes. If I reboot, this will solve the problem temporarily until the computer sleeps normally or I initiate sleep. After that it reverts to the abbreviated sleep mode. This started happening after I installed Windows 10. Additionally, I'm using a wireless mouse and keyboard (Microsoft & Logitech) that I have turned off the "allow this device to wake your PC" option, but the same thing happens.



This computer was made by a third party, but I checked through the command line, and the motherboard is an Intel Desktop DP55WB Media Series microATX.



Any clues as to where I should start looking?










share|improve this question

























  • It would help if you would indicate the computer type and model you are talking about. even desktop motherboards can have some software that works with or changes the power plans. superuser.com/questions/984881/… a Question similar to this was asked.

    – Psycogeek
    Dec 29 '15 at 1:34











  • I don't have a make and model, but I figured out the motherboard and added it to the question. Hopefully that helps.

    – user2168046
    Dec 29 '15 at 3:13






  • 1





    check also these older ones superuser.com/questions/556883/… & superuser.com/questions/124772/… because they at least have answers, and things to look for even if it is the older os. Another idea would be to create your own custom power profile starting with whatever they call a high performance one, that will place a new item in the registry, and start with a no sleep type of profile. Check to see what power profile is applied when it occurs

    – Psycogeek
    Dec 30 '15 at 4:01








  • 1





    @Facebook Awarding existing answer

    – Martheen Cahya Paulo
    Sep 28 '17 at 20:38






  • 1





    @MartheenCahyaPaulo thanks for the bounty that was a pleasant surprise :)

    – User
    Oct 4 '17 at 16:07














29












29








29


19






My computer is falling asleep outside of the screen and sleep times that I have set. I have made sure that the screen saver is set to none, and that the power options and advanced settings match the sleep settings. Regardless, though I have set sleep to 1 hr, it will go to sleep after approximately 2-4 minutes. If I reboot, this will solve the problem temporarily until the computer sleeps normally or I initiate sleep. After that it reverts to the abbreviated sleep mode. This started happening after I installed Windows 10. Additionally, I'm using a wireless mouse and keyboard (Microsoft & Logitech) that I have turned off the "allow this device to wake your PC" option, but the same thing happens.



This computer was made by a third party, but I checked through the command line, and the motherboard is an Intel Desktop DP55WB Media Series microATX.



Any clues as to where I should start looking?










share|improve this question
















My computer is falling asleep outside of the screen and sleep times that I have set. I have made sure that the screen saver is set to none, and that the power options and advanced settings match the sleep settings. Regardless, though I have set sleep to 1 hr, it will go to sleep after approximately 2-4 minutes. If I reboot, this will solve the problem temporarily until the computer sleeps normally or I initiate sleep. After that it reverts to the abbreviated sleep mode. This started happening after I installed Windows 10. Additionally, I'm using a wireless mouse and keyboard (Microsoft & Logitech) that I have turned off the "allow this device to wake your PC" option, but the same thing happens.



This computer was made by a third party, but I checked through the command line, and the motherboard is an Intel Desktop DP55WB Media Series microATX.



Any clues as to where I should start looking?







windows-10 sleep






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '15 at 3:09







user2168046

















asked Dec 29 '15 at 1:09









user2168046user2168046

158126




158126













  • It would help if you would indicate the computer type and model you are talking about. even desktop motherboards can have some software that works with or changes the power plans. superuser.com/questions/984881/… a Question similar to this was asked.

    – Psycogeek
    Dec 29 '15 at 1:34











  • I don't have a make and model, but I figured out the motherboard and added it to the question. Hopefully that helps.

    – user2168046
    Dec 29 '15 at 3:13






  • 1





    check also these older ones superuser.com/questions/556883/… & superuser.com/questions/124772/… because they at least have answers, and things to look for even if it is the older os. Another idea would be to create your own custom power profile starting with whatever they call a high performance one, that will place a new item in the registry, and start with a no sleep type of profile. Check to see what power profile is applied when it occurs

    – Psycogeek
    Dec 30 '15 at 4:01








  • 1





    @Facebook Awarding existing answer

    – Martheen Cahya Paulo
    Sep 28 '17 at 20:38






  • 1





    @MartheenCahyaPaulo thanks for the bounty that was a pleasant surprise :)

    – User
    Oct 4 '17 at 16:07



















  • It would help if you would indicate the computer type and model you are talking about. even desktop motherboards can have some software that works with or changes the power plans. superuser.com/questions/984881/… a Question similar to this was asked.

    – Psycogeek
    Dec 29 '15 at 1:34











  • I don't have a make and model, but I figured out the motherboard and added it to the question. Hopefully that helps.

    – user2168046
    Dec 29 '15 at 3:13






  • 1





    check also these older ones superuser.com/questions/556883/… & superuser.com/questions/124772/… because they at least have answers, and things to look for even if it is the older os. Another idea would be to create your own custom power profile starting with whatever they call a high performance one, that will place a new item in the registry, and start with a no sleep type of profile. Check to see what power profile is applied when it occurs

    – Psycogeek
    Dec 30 '15 at 4:01








  • 1





    @Facebook Awarding existing answer

    – Martheen Cahya Paulo
    Sep 28 '17 at 20:38






  • 1





    @MartheenCahyaPaulo thanks for the bounty that was a pleasant surprise :)

    – User
    Oct 4 '17 at 16:07

















It would help if you would indicate the computer type and model you are talking about. even desktop motherboards can have some software that works with or changes the power plans. superuser.com/questions/984881/… a Question similar to this was asked.

– Psycogeek
Dec 29 '15 at 1:34





It would help if you would indicate the computer type and model you are talking about. even desktop motherboards can have some software that works with or changes the power plans. superuser.com/questions/984881/… a Question similar to this was asked.

– Psycogeek
Dec 29 '15 at 1:34













I don't have a make and model, but I figured out the motherboard and added it to the question. Hopefully that helps.

– user2168046
Dec 29 '15 at 3:13





I don't have a make and model, but I figured out the motherboard and added it to the question. Hopefully that helps.

– user2168046
Dec 29 '15 at 3:13




1




1





check also these older ones superuser.com/questions/556883/… & superuser.com/questions/124772/… because they at least have answers, and things to look for even if it is the older os. Another idea would be to create your own custom power profile starting with whatever they call a high performance one, that will place a new item in the registry, and start with a no sleep type of profile. Check to see what power profile is applied when it occurs

– Psycogeek
Dec 30 '15 at 4:01







check also these older ones superuser.com/questions/556883/… & superuser.com/questions/124772/… because they at least have answers, and things to look for even if it is the older os. Another idea would be to create your own custom power profile starting with whatever they call a high performance one, that will place a new item in the registry, and start with a no sleep type of profile. Check to see what power profile is applied when it occurs

– Psycogeek
Dec 30 '15 at 4:01






1




1





@Facebook Awarding existing answer

– Martheen Cahya Paulo
Sep 28 '17 at 20:38





@Facebook Awarding existing answer

– Martheen Cahya Paulo
Sep 28 '17 at 20:38




1




1





@MartheenCahyaPaulo thanks for the bounty that was a pleasant surprise :)

– User
Oct 4 '17 at 16:07





@MartheenCahyaPaulo thanks for the bounty that was a pleasant surprise :)

– User
Oct 4 '17 at 16:07










4 Answers
4






active

oldest

votes


















39





+300









System unattended sleep timeout



There is a hidden setting in the Power Options control panel called System unattended sleep timeout. By default it is set to two minutes and is not visible in the control panel. As far as I know, a registry tweak is required to make it visible.



The tweak involves changing the value of the "Attributes" key from 1 to 2 in the following location:




[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings238C9FA8-0AAD-41ED-83F4-97BE242C8F207bc4a2f9-d8fc-4469-b07b-33eb785aaca0]




Changing the value back to 1 re-hides the power option.



After making the above registry tweak open the Power Options control panel and there should now be a System unattended sleep timeout setting:



enter image description here



A reboot may be a good idea after.



You can read more about it here (and also download a .reg patch file if you want):
http://www.sevenforums.com/tutorials/246364-power-options-add-system-unattended-sleep-timeout.html



Console lock display off timeout



There is also a somewhat related setting Console lock display off timeout which also requires a registry tweak to enable. I did not find this tweak necessary to fix my problem but perhaps you may. The tweak again involves changing the value of the "Attributes" key from 1 to 2, this time in the following location:




HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings7516b95f-f776-4464-8c53-06167f40cc998EC4B3A5-6868-48c2-BE75-4F3044BE88A7




And you can read more about it here:
http://www.eightforums.com/tutorials/8267-power-options-add-console-lock-display-off-timeout.html






share|improve this answer
























  • Possibly related Monitor powers off after 1 minute when PC is locked

    – User
    Jan 9 '16 at 10:22






  • 1





    I may try these if I can't find another solution. These seem to address a different problem than what I'm dealing with though. It isn't the monitor, and I've disabled the lock screen. As to the first tweak, the computer isn't waking up idle, it will just go into sleep mode at any instance of idleness. Playing media will prevent it though, so I know that power setting is still working.

    – user2168046
    Jan 14 '16 at 23:43








  • 5





    It is hard to understand what motivates Microsoft to have a hidden "2 minutes unattended" setting. In fact, it is also hard to understand why the power settings are so complicated (and distributed throughout different generations of MS config widgets and Registry Edits). I find this kind of stuff incredibly annoying and tedious to figure out. Apple's Settings have changed very little in the last 10 years. And I suspect Linux power settings are also more simple.

    – JL Peyret
    Jul 8 '17 at 6:51













  • This solved my problem. Thanks. This is what drives me nuts about Windows. I changed nothing, yet this happens. Why ? Don't know. Will it happen again ? Maybe. Will I remember this obscure fix ? Probably not. Gah.

    – Phil
    Aug 25 '17 at 16:02








  • 1





    @JLPeyret According to Microsoft's Documentation, the unattended sleep timeout is only supposed to be used instead of the normal sleep timeout if the system wakes itself up instead of the user waking it up. For instance, if the system is woken by a scheduled event, it would fall back asleep after two minutes by default. For some reason, however, it seems the value is used even for user initiated wake-ups on some computers.

    – Vaelus
    Feb 13 '18 at 3:48





















3














For further solution thoroughness in case all other solutions provided do not work to keep the Windows machine from going into a power saving or sleep mode, I'll provide a workaround solution that has worked for me when no other settings could be determined to resolve it otherwise.





Prevent Windows from Sleeping



Note: You can still set any other power saving prevention settings I don't mention if you want.



Creating Script Directory





  1. Create a C:Scripts and C:ScriptsTemp folder change the ScriptDir variable value to be something different if you wish and use the below command line logic to do this for you





    • Copy and paste this into command line to create the folder this way




      SET ScriptDir=C:Scripts
      IF NOT EXIST "%ScriptDir%" MD "%ScriptDir%"



    • The batch script below needs to be copied into the root of the C:Scripts folder







Creating Batch Script





  1. This is the batch script you'll create and/or copy to the script directory you decided to use so you can automate the script execution with Task Scheduler.




    • Essentially this script uses sendkeys to emulate the pressing of the spacebar 8 times but I put the logic in a FOR /L to lessen the script logic needed.



    • @ECHO ON

      IF NOT EXIST "%~dp0Temp" MD "%~dp0Temp"
      SET TempVBSFile=%~dp0Temp~tmpSendKeysTemp.vbs
      IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"

      FOR /L %%A IN (1,1,9) DO (
      IF %%A==1 ECHO Set WshShell = WScript.CreateObject^("WScript.Shell"^)>>"%TempVBSFile%"
      IF NOT %%A==9 ECHO Wscript.Sleep 500 >>"%TempVBSFile%" & ECHO WshShell.SendKeys " ">>"%TempVBSFile%"
      )
      EXIT


    • Schedule a task with Task Scheduler using the settings as specified in the Scheduling Batch Script section







Scheduling Batch Script



Note: Open Task Scheduler or type in Taskschd.msc from Run and press Enter.





  1. From the General tab you will want to be sure the Run whether user is logged on or not is checked, Run with the highest privileges is checked, and that you also run the task with a credential that has local administrator privileges is you can.




    • enter image description here




  2. From the Triggers tab, define a New trigger and be sure to set options:





    • Begin the task: with a value of On a schedule


    • Start: with a time value of 12:00:00 AM


    • Settings: with the Daily value checked


    • Recur every: with a 1 day value


    • Repeat task every: with a 10 minutes value


    • For a duration of: with an Indefinitely value

    • The Enabled option should be checked


    • enter image description here





  3. From the Actions tab, define a New action and be sure to set options:





    • Action: with a value of Start a program


    • Program/script: with a value of full path to the batch script i.e. C:ScriptsWakeUpWindows.cmd

    • Start in (optional): with the value of the script directory i.e. C:Scripts


    • enter image description here





  4. From the Conditions tab be sure to set and/or check to enable options:





    • Start the task only if the computer is idle for: should be checked and have a value of 10 minutes




      • Only execute the script if the computer has been idle for 10 minutes. If the computer has not been idle for 10 minutes then likely someone has used it and the process shouldn't need to run yet.




    • Wait for idle for: with a value of 5 minutes




      • When the idle for 10 minutes condition is false this tells it keep checking for up to an additional 5 minutes and still execute the script if the 10 minute idle condition becomes true within that 5 minute window.




    • The Stop if the computer ceases to be idle option should be checked





      • If the Stop if the computer ceases to be idle condition is selected
        for a task and the task is running while the computer is in an idle
        state, then the task will stop running when the computer ceases to be
        idle.



        source





    • The Wake the computer to run this task option should be checked


    • enter image description here




    A computer is considered to be in an idle state when a screen saver is
    running. If a screen saver is not running, then the computer is
    considered to be in an idle state if there is 0% CPU usage and 0% disk
    input or output for 90% of the past fifteen minutes and if there is no
    keyboard or mouse input during this period of time. Once the Task
    Scheduler service detects that the computer is in an idle state, the
    service only waits for user input to mark the end of the idle state.



    source







Additional Power Saving Settings




  1. From an elevated command prompt run POWERCFG -H OFF to disable hibernation just in case it’s not already disabled.



  2. Copy control /name Microsoft.PowerOptions into Run and then press Enter.



    enter image description here




  3. Click on Change plan settings for whichever Preferred plan is checked to open the Edit Plan Settings screen.



    enter image description here




  4. Be sure the Put computer to sleep value is set to Never, and then click on the Change advanced power settings option



    enter image description here




  5. From the Advanced settings find and expand Hard disk, and then set the Turn off hard disk after Setting (minutes) to a value of Never




    Note: Be sure to Apply and Save Changes where applicable




    enter image description here



  6. Open Device Manager or type in devmgmt.msc from Run and press Enter.


  7. From Device Manager expand Network adapters, right click on the main NIC (or all if you wish one-by-one) and select Properties. From the Power Management tab, uncheck the option Allow the computer to turn off the device to save power.



enter image description here





Further Resources




  • Scheduled Task Problems

  • FOR /L

  • SendKeys

  • Task Conditions

  • Powercfg






share|improve this answer


























  • So this would keep the computer always on right? What I like about the answer I awarded the bounty is they pointed out the why, and the PC can still go sleep when left idle (at least until next season update with more obscure registry keys). Caffeine use similar approach with yours, they use F15 instead of spacebar to reduce intrusion, and they mentioned it even could interfere with Google Docs & Putty. But kudos to you for such detailed answer.

    – Martheen Cahya Paulo
    Oct 1 '17 at 2:49











  • @MartheenCahyaPaulo If all else fails, simply use this and perhaps it'll resolve your problem using 100% Windows native solution as a workaround. You are correct regarding the registry keys though, what that is today may be something different or in conjunction with tomorrow and thus this workaround solution I provided with detail. Again, I have two other answers with similar content that I'll be updating with some of this information as well in the near future—I'm glad I ran across the question regardless.

    – Pimp Juice IT
    Oct 1 '17 at 4:45





















0














Just for completeness, sometimes
the root of this problem are customized power plan settings.



To fix it by resetting and then re-configuring your power settings, you need to:




  1. Start Menu -> Settings -> System -> Power & sleep in the left pane.

  2. In the right pane, click on Additional power settings.

  3. Select Choose when to turn off the display.

  4. Click on Change advanced power settings.

  5. Click on Restore plan defaults.


The Power Troubleshooter can also help, accessed via :
Start Menu -> Troubleshooting -> Improve power usage -> Power.






share|improve this answer































    -2














    Putting this here for the next person like me searching for an answer and winds up here....
    Editing the registry to enable "Sleep Unattended Sleep Timeout" setting (as mentioned above) and then changing that setting to the same sleep timeout I normally use worked for me. I found detailed instructions here: https://appuals.com/windows-10-sleeps-after-1-4-minutes-of-inactivity/






    share|improve this answer



















    • 4





      You should quote and cite your reference link, so ALL relevant information, is contained in the body of your answer.

      – Ramhound
      May 17 '17 at 22:07












    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1019043%2fwindows-10-sleeps-before-set-time%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    39





    +300









    System unattended sleep timeout



    There is a hidden setting in the Power Options control panel called System unattended sleep timeout. By default it is set to two minutes and is not visible in the control panel. As far as I know, a registry tweak is required to make it visible.



    The tweak involves changing the value of the "Attributes" key from 1 to 2 in the following location:




    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings238C9FA8-0AAD-41ED-83F4-97BE242C8F207bc4a2f9-d8fc-4469-b07b-33eb785aaca0]




    Changing the value back to 1 re-hides the power option.



    After making the above registry tweak open the Power Options control panel and there should now be a System unattended sleep timeout setting:



    enter image description here



    A reboot may be a good idea after.



    You can read more about it here (and also download a .reg patch file if you want):
    http://www.sevenforums.com/tutorials/246364-power-options-add-system-unattended-sleep-timeout.html



    Console lock display off timeout



    There is also a somewhat related setting Console lock display off timeout which also requires a registry tweak to enable. I did not find this tweak necessary to fix my problem but perhaps you may. The tweak again involves changing the value of the "Attributes" key from 1 to 2, this time in the following location:




    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings7516b95f-f776-4464-8c53-06167f40cc998EC4B3A5-6868-48c2-BE75-4F3044BE88A7




    And you can read more about it here:
    http://www.eightforums.com/tutorials/8267-power-options-add-console-lock-display-off-timeout.html






    share|improve this answer
























    • Possibly related Monitor powers off after 1 minute when PC is locked

      – User
      Jan 9 '16 at 10:22






    • 1





      I may try these if I can't find another solution. These seem to address a different problem than what I'm dealing with though. It isn't the monitor, and I've disabled the lock screen. As to the first tweak, the computer isn't waking up idle, it will just go into sleep mode at any instance of idleness. Playing media will prevent it though, so I know that power setting is still working.

      – user2168046
      Jan 14 '16 at 23:43








    • 5





      It is hard to understand what motivates Microsoft to have a hidden "2 minutes unattended" setting. In fact, it is also hard to understand why the power settings are so complicated (and distributed throughout different generations of MS config widgets and Registry Edits). I find this kind of stuff incredibly annoying and tedious to figure out. Apple's Settings have changed very little in the last 10 years. And I suspect Linux power settings are also more simple.

      – JL Peyret
      Jul 8 '17 at 6:51













    • This solved my problem. Thanks. This is what drives me nuts about Windows. I changed nothing, yet this happens. Why ? Don't know. Will it happen again ? Maybe. Will I remember this obscure fix ? Probably not. Gah.

      – Phil
      Aug 25 '17 at 16:02








    • 1





      @JLPeyret According to Microsoft's Documentation, the unattended sleep timeout is only supposed to be used instead of the normal sleep timeout if the system wakes itself up instead of the user waking it up. For instance, if the system is woken by a scheduled event, it would fall back asleep after two minutes by default. For some reason, however, it seems the value is used even for user initiated wake-ups on some computers.

      – Vaelus
      Feb 13 '18 at 3:48


















    39





    +300









    System unattended sleep timeout



    There is a hidden setting in the Power Options control panel called System unattended sleep timeout. By default it is set to two minutes and is not visible in the control panel. As far as I know, a registry tweak is required to make it visible.



    The tweak involves changing the value of the "Attributes" key from 1 to 2 in the following location:




    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings238C9FA8-0AAD-41ED-83F4-97BE242C8F207bc4a2f9-d8fc-4469-b07b-33eb785aaca0]




    Changing the value back to 1 re-hides the power option.



    After making the above registry tweak open the Power Options control panel and there should now be a System unattended sleep timeout setting:



    enter image description here



    A reboot may be a good idea after.



    You can read more about it here (and also download a .reg patch file if you want):
    http://www.sevenforums.com/tutorials/246364-power-options-add-system-unattended-sleep-timeout.html



    Console lock display off timeout



    There is also a somewhat related setting Console lock display off timeout which also requires a registry tweak to enable. I did not find this tweak necessary to fix my problem but perhaps you may. The tweak again involves changing the value of the "Attributes" key from 1 to 2, this time in the following location:




    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings7516b95f-f776-4464-8c53-06167f40cc998EC4B3A5-6868-48c2-BE75-4F3044BE88A7




    And you can read more about it here:
    http://www.eightforums.com/tutorials/8267-power-options-add-console-lock-display-off-timeout.html






    share|improve this answer
























    • Possibly related Monitor powers off after 1 minute when PC is locked

      – User
      Jan 9 '16 at 10:22






    • 1





      I may try these if I can't find another solution. These seem to address a different problem than what I'm dealing with though. It isn't the monitor, and I've disabled the lock screen. As to the first tweak, the computer isn't waking up idle, it will just go into sleep mode at any instance of idleness. Playing media will prevent it though, so I know that power setting is still working.

      – user2168046
      Jan 14 '16 at 23:43








    • 5





      It is hard to understand what motivates Microsoft to have a hidden "2 minutes unattended" setting. In fact, it is also hard to understand why the power settings are so complicated (and distributed throughout different generations of MS config widgets and Registry Edits). I find this kind of stuff incredibly annoying and tedious to figure out. Apple's Settings have changed very little in the last 10 years. And I suspect Linux power settings are also more simple.

      – JL Peyret
      Jul 8 '17 at 6:51













    • This solved my problem. Thanks. This is what drives me nuts about Windows. I changed nothing, yet this happens. Why ? Don't know. Will it happen again ? Maybe. Will I remember this obscure fix ? Probably not. Gah.

      – Phil
      Aug 25 '17 at 16:02








    • 1





      @JLPeyret According to Microsoft's Documentation, the unattended sleep timeout is only supposed to be used instead of the normal sleep timeout if the system wakes itself up instead of the user waking it up. For instance, if the system is woken by a scheduled event, it would fall back asleep after two minutes by default. For some reason, however, it seems the value is used even for user initiated wake-ups on some computers.

      – Vaelus
      Feb 13 '18 at 3:48
















    39





    +300







    39





    +300



    39




    +300





    System unattended sleep timeout



    There is a hidden setting in the Power Options control panel called System unattended sleep timeout. By default it is set to two minutes and is not visible in the control panel. As far as I know, a registry tweak is required to make it visible.



    The tweak involves changing the value of the "Attributes" key from 1 to 2 in the following location:




    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings238C9FA8-0AAD-41ED-83F4-97BE242C8F207bc4a2f9-d8fc-4469-b07b-33eb785aaca0]




    Changing the value back to 1 re-hides the power option.



    After making the above registry tweak open the Power Options control panel and there should now be a System unattended sleep timeout setting:



    enter image description here



    A reboot may be a good idea after.



    You can read more about it here (and also download a .reg patch file if you want):
    http://www.sevenforums.com/tutorials/246364-power-options-add-system-unattended-sleep-timeout.html



    Console lock display off timeout



    There is also a somewhat related setting Console lock display off timeout which also requires a registry tweak to enable. I did not find this tweak necessary to fix my problem but perhaps you may. The tweak again involves changing the value of the "Attributes" key from 1 to 2, this time in the following location:




    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings7516b95f-f776-4464-8c53-06167f40cc998EC4B3A5-6868-48c2-BE75-4F3044BE88A7




    And you can read more about it here:
    http://www.eightforums.com/tutorials/8267-power-options-add-console-lock-display-off-timeout.html






    share|improve this answer













    System unattended sleep timeout



    There is a hidden setting in the Power Options control panel called System unattended sleep timeout. By default it is set to two minutes and is not visible in the control panel. As far as I know, a registry tweak is required to make it visible.



    The tweak involves changing the value of the "Attributes" key from 1 to 2 in the following location:




    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings238C9FA8-0AAD-41ED-83F4-97BE242C8F207bc4a2f9-d8fc-4469-b07b-33eb785aaca0]




    Changing the value back to 1 re-hides the power option.



    After making the above registry tweak open the Power Options control panel and there should now be a System unattended sleep timeout setting:



    enter image description here



    A reboot may be a good idea after.



    You can read more about it here (and also download a .reg patch file if you want):
    http://www.sevenforums.com/tutorials/246364-power-options-add-system-unattended-sleep-timeout.html



    Console lock display off timeout



    There is also a somewhat related setting Console lock display off timeout which also requires a registry tweak to enable. I did not find this tweak necessary to fix my problem but perhaps you may. The tweak again involves changing the value of the "Attributes" key from 1 to 2, this time in the following location:




    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlPowerPowerSettings7516b95f-f776-4464-8c53-06167f40cc998EC4B3A5-6868-48c2-BE75-4F3044BE88A7




    And you can read more about it here:
    http://www.eightforums.com/tutorials/8267-power-options-add-console-lock-display-off-timeout.html







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 9 '16 at 6:51









    UserUser

    1,83052338




    1,83052338













    • Possibly related Monitor powers off after 1 minute when PC is locked

      – User
      Jan 9 '16 at 10:22






    • 1





      I may try these if I can't find another solution. These seem to address a different problem than what I'm dealing with though. It isn't the monitor, and I've disabled the lock screen. As to the first tweak, the computer isn't waking up idle, it will just go into sleep mode at any instance of idleness. Playing media will prevent it though, so I know that power setting is still working.

      – user2168046
      Jan 14 '16 at 23:43








    • 5





      It is hard to understand what motivates Microsoft to have a hidden "2 minutes unattended" setting. In fact, it is also hard to understand why the power settings are so complicated (and distributed throughout different generations of MS config widgets and Registry Edits). I find this kind of stuff incredibly annoying and tedious to figure out. Apple's Settings have changed very little in the last 10 years. And I suspect Linux power settings are also more simple.

      – JL Peyret
      Jul 8 '17 at 6:51













    • This solved my problem. Thanks. This is what drives me nuts about Windows. I changed nothing, yet this happens. Why ? Don't know. Will it happen again ? Maybe. Will I remember this obscure fix ? Probably not. Gah.

      – Phil
      Aug 25 '17 at 16:02








    • 1





      @JLPeyret According to Microsoft's Documentation, the unattended sleep timeout is only supposed to be used instead of the normal sleep timeout if the system wakes itself up instead of the user waking it up. For instance, if the system is woken by a scheduled event, it would fall back asleep after two minutes by default. For some reason, however, it seems the value is used even for user initiated wake-ups on some computers.

      – Vaelus
      Feb 13 '18 at 3:48





















    • Possibly related Monitor powers off after 1 minute when PC is locked

      – User
      Jan 9 '16 at 10:22






    • 1





      I may try these if I can't find another solution. These seem to address a different problem than what I'm dealing with though. It isn't the monitor, and I've disabled the lock screen. As to the first tweak, the computer isn't waking up idle, it will just go into sleep mode at any instance of idleness. Playing media will prevent it though, so I know that power setting is still working.

      – user2168046
      Jan 14 '16 at 23:43








    • 5





      It is hard to understand what motivates Microsoft to have a hidden "2 minutes unattended" setting. In fact, it is also hard to understand why the power settings are so complicated (and distributed throughout different generations of MS config widgets and Registry Edits). I find this kind of stuff incredibly annoying and tedious to figure out. Apple's Settings have changed very little in the last 10 years. And I suspect Linux power settings are also more simple.

      – JL Peyret
      Jul 8 '17 at 6:51













    • This solved my problem. Thanks. This is what drives me nuts about Windows. I changed nothing, yet this happens. Why ? Don't know. Will it happen again ? Maybe. Will I remember this obscure fix ? Probably not. Gah.

      – Phil
      Aug 25 '17 at 16:02








    • 1





      @JLPeyret According to Microsoft's Documentation, the unattended sleep timeout is only supposed to be used instead of the normal sleep timeout if the system wakes itself up instead of the user waking it up. For instance, if the system is woken by a scheduled event, it would fall back asleep after two minutes by default. For some reason, however, it seems the value is used even for user initiated wake-ups on some computers.

      – Vaelus
      Feb 13 '18 at 3:48



















    Possibly related Monitor powers off after 1 minute when PC is locked

    – User
    Jan 9 '16 at 10:22





    Possibly related Monitor powers off after 1 minute when PC is locked

    – User
    Jan 9 '16 at 10:22




    1




    1





    I may try these if I can't find another solution. These seem to address a different problem than what I'm dealing with though. It isn't the monitor, and I've disabled the lock screen. As to the first tweak, the computer isn't waking up idle, it will just go into sleep mode at any instance of idleness. Playing media will prevent it though, so I know that power setting is still working.

    – user2168046
    Jan 14 '16 at 23:43







    I may try these if I can't find another solution. These seem to address a different problem than what I'm dealing with though. It isn't the monitor, and I've disabled the lock screen. As to the first tweak, the computer isn't waking up idle, it will just go into sleep mode at any instance of idleness. Playing media will prevent it though, so I know that power setting is still working.

    – user2168046
    Jan 14 '16 at 23:43






    5




    5





    It is hard to understand what motivates Microsoft to have a hidden "2 minutes unattended" setting. In fact, it is also hard to understand why the power settings are so complicated (and distributed throughout different generations of MS config widgets and Registry Edits). I find this kind of stuff incredibly annoying and tedious to figure out. Apple's Settings have changed very little in the last 10 years. And I suspect Linux power settings are also more simple.

    – JL Peyret
    Jul 8 '17 at 6:51







    It is hard to understand what motivates Microsoft to have a hidden "2 minutes unattended" setting. In fact, it is also hard to understand why the power settings are so complicated (and distributed throughout different generations of MS config widgets and Registry Edits). I find this kind of stuff incredibly annoying and tedious to figure out. Apple's Settings have changed very little in the last 10 years. And I suspect Linux power settings are also more simple.

    – JL Peyret
    Jul 8 '17 at 6:51















    This solved my problem. Thanks. This is what drives me nuts about Windows. I changed nothing, yet this happens. Why ? Don't know. Will it happen again ? Maybe. Will I remember this obscure fix ? Probably not. Gah.

    – Phil
    Aug 25 '17 at 16:02







    This solved my problem. Thanks. This is what drives me nuts about Windows. I changed nothing, yet this happens. Why ? Don't know. Will it happen again ? Maybe. Will I remember this obscure fix ? Probably not. Gah.

    – Phil
    Aug 25 '17 at 16:02






    1




    1





    @JLPeyret According to Microsoft's Documentation, the unattended sleep timeout is only supposed to be used instead of the normal sleep timeout if the system wakes itself up instead of the user waking it up. For instance, if the system is woken by a scheduled event, it would fall back asleep after two minutes by default. For some reason, however, it seems the value is used even for user initiated wake-ups on some computers.

    – Vaelus
    Feb 13 '18 at 3:48







    @JLPeyret According to Microsoft's Documentation, the unattended sleep timeout is only supposed to be used instead of the normal sleep timeout if the system wakes itself up instead of the user waking it up. For instance, if the system is woken by a scheduled event, it would fall back asleep after two minutes by default. For some reason, however, it seems the value is used even for user initiated wake-ups on some computers.

    – Vaelus
    Feb 13 '18 at 3:48















    3














    For further solution thoroughness in case all other solutions provided do not work to keep the Windows machine from going into a power saving or sleep mode, I'll provide a workaround solution that has worked for me when no other settings could be determined to resolve it otherwise.





    Prevent Windows from Sleeping



    Note: You can still set any other power saving prevention settings I don't mention if you want.



    Creating Script Directory





    1. Create a C:Scripts and C:ScriptsTemp folder change the ScriptDir variable value to be something different if you wish and use the below command line logic to do this for you





      • Copy and paste this into command line to create the folder this way




        SET ScriptDir=C:Scripts
        IF NOT EXIST "%ScriptDir%" MD "%ScriptDir%"



      • The batch script below needs to be copied into the root of the C:Scripts folder







    Creating Batch Script





    1. This is the batch script you'll create and/or copy to the script directory you decided to use so you can automate the script execution with Task Scheduler.




      • Essentially this script uses sendkeys to emulate the pressing of the spacebar 8 times but I put the logic in a FOR /L to lessen the script logic needed.



      • @ECHO ON

        IF NOT EXIST "%~dp0Temp" MD "%~dp0Temp"
        SET TempVBSFile=%~dp0Temp~tmpSendKeysTemp.vbs
        IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"

        FOR /L %%A IN (1,1,9) DO (
        IF %%A==1 ECHO Set WshShell = WScript.CreateObject^("WScript.Shell"^)>>"%TempVBSFile%"
        IF NOT %%A==9 ECHO Wscript.Sleep 500 >>"%TempVBSFile%" & ECHO WshShell.SendKeys " ">>"%TempVBSFile%"
        )
        EXIT


      • Schedule a task with Task Scheduler using the settings as specified in the Scheduling Batch Script section







    Scheduling Batch Script



    Note: Open Task Scheduler or type in Taskschd.msc from Run and press Enter.





    1. From the General tab you will want to be sure the Run whether user is logged on or not is checked, Run with the highest privileges is checked, and that you also run the task with a credential that has local administrator privileges is you can.




      • enter image description here




    2. From the Triggers tab, define a New trigger and be sure to set options:





      • Begin the task: with a value of On a schedule


      • Start: with a time value of 12:00:00 AM


      • Settings: with the Daily value checked


      • Recur every: with a 1 day value


      • Repeat task every: with a 10 minutes value


      • For a duration of: with an Indefinitely value

      • The Enabled option should be checked


      • enter image description here





    3. From the Actions tab, define a New action and be sure to set options:





      • Action: with a value of Start a program


      • Program/script: with a value of full path to the batch script i.e. C:ScriptsWakeUpWindows.cmd

      • Start in (optional): with the value of the script directory i.e. C:Scripts


      • enter image description here





    4. From the Conditions tab be sure to set and/or check to enable options:





      • Start the task only if the computer is idle for: should be checked and have a value of 10 minutes




        • Only execute the script if the computer has been idle for 10 minutes. If the computer has not been idle for 10 minutes then likely someone has used it and the process shouldn't need to run yet.




      • Wait for idle for: with a value of 5 minutes




        • When the idle for 10 minutes condition is false this tells it keep checking for up to an additional 5 minutes and still execute the script if the 10 minute idle condition becomes true within that 5 minute window.




      • The Stop if the computer ceases to be idle option should be checked





        • If the Stop if the computer ceases to be idle condition is selected
          for a task and the task is running while the computer is in an idle
          state, then the task will stop running when the computer ceases to be
          idle.



          source





      • The Wake the computer to run this task option should be checked


      • enter image description here




      A computer is considered to be in an idle state when a screen saver is
      running. If a screen saver is not running, then the computer is
      considered to be in an idle state if there is 0% CPU usage and 0% disk
      input or output for 90% of the past fifteen minutes and if there is no
      keyboard or mouse input during this period of time. Once the Task
      Scheduler service detects that the computer is in an idle state, the
      service only waits for user input to mark the end of the idle state.



      source







    Additional Power Saving Settings




    1. From an elevated command prompt run POWERCFG -H OFF to disable hibernation just in case it’s not already disabled.



    2. Copy control /name Microsoft.PowerOptions into Run and then press Enter.



      enter image description here




    3. Click on Change plan settings for whichever Preferred plan is checked to open the Edit Plan Settings screen.



      enter image description here




    4. Be sure the Put computer to sleep value is set to Never, and then click on the Change advanced power settings option



      enter image description here




    5. From the Advanced settings find and expand Hard disk, and then set the Turn off hard disk after Setting (minutes) to a value of Never




      Note: Be sure to Apply and Save Changes where applicable




      enter image description here



    6. Open Device Manager or type in devmgmt.msc from Run and press Enter.


    7. From Device Manager expand Network adapters, right click on the main NIC (or all if you wish one-by-one) and select Properties. From the Power Management tab, uncheck the option Allow the computer to turn off the device to save power.



    enter image description here





    Further Resources




    • Scheduled Task Problems

    • FOR /L

    • SendKeys

    • Task Conditions

    • Powercfg






    share|improve this answer


























    • So this would keep the computer always on right? What I like about the answer I awarded the bounty is they pointed out the why, and the PC can still go sleep when left idle (at least until next season update with more obscure registry keys). Caffeine use similar approach with yours, they use F15 instead of spacebar to reduce intrusion, and they mentioned it even could interfere with Google Docs & Putty. But kudos to you for such detailed answer.

      – Martheen Cahya Paulo
      Oct 1 '17 at 2:49











    • @MartheenCahyaPaulo If all else fails, simply use this and perhaps it'll resolve your problem using 100% Windows native solution as a workaround. You are correct regarding the registry keys though, what that is today may be something different or in conjunction with tomorrow and thus this workaround solution I provided with detail. Again, I have two other answers with similar content that I'll be updating with some of this information as well in the near future—I'm glad I ran across the question regardless.

      – Pimp Juice IT
      Oct 1 '17 at 4:45


















    3














    For further solution thoroughness in case all other solutions provided do not work to keep the Windows machine from going into a power saving or sleep mode, I'll provide a workaround solution that has worked for me when no other settings could be determined to resolve it otherwise.





    Prevent Windows from Sleeping



    Note: You can still set any other power saving prevention settings I don't mention if you want.



    Creating Script Directory





    1. Create a C:Scripts and C:ScriptsTemp folder change the ScriptDir variable value to be something different if you wish and use the below command line logic to do this for you





      • Copy and paste this into command line to create the folder this way




        SET ScriptDir=C:Scripts
        IF NOT EXIST "%ScriptDir%" MD "%ScriptDir%"



      • The batch script below needs to be copied into the root of the C:Scripts folder







    Creating Batch Script





    1. This is the batch script you'll create and/or copy to the script directory you decided to use so you can automate the script execution with Task Scheduler.




      • Essentially this script uses sendkeys to emulate the pressing of the spacebar 8 times but I put the logic in a FOR /L to lessen the script logic needed.



      • @ECHO ON

        IF NOT EXIST "%~dp0Temp" MD "%~dp0Temp"
        SET TempVBSFile=%~dp0Temp~tmpSendKeysTemp.vbs
        IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"

        FOR /L %%A IN (1,1,9) DO (
        IF %%A==1 ECHO Set WshShell = WScript.CreateObject^("WScript.Shell"^)>>"%TempVBSFile%"
        IF NOT %%A==9 ECHO Wscript.Sleep 500 >>"%TempVBSFile%" & ECHO WshShell.SendKeys " ">>"%TempVBSFile%"
        )
        EXIT


      • Schedule a task with Task Scheduler using the settings as specified in the Scheduling Batch Script section







    Scheduling Batch Script



    Note: Open Task Scheduler or type in Taskschd.msc from Run and press Enter.





    1. From the General tab you will want to be sure the Run whether user is logged on or not is checked, Run with the highest privileges is checked, and that you also run the task with a credential that has local administrator privileges is you can.




      • enter image description here




    2. From the Triggers tab, define a New trigger and be sure to set options:





      • Begin the task: with a value of On a schedule


      • Start: with a time value of 12:00:00 AM


      • Settings: with the Daily value checked


      • Recur every: with a 1 day value


      • Repeat task every: with a 10 minutes value


      • For a duration of: with an Indefinitely value

      • The Enabled option should be checked


      • enter image description here





    3. From the Actions tab, define a New action and be sure to set options:





      • Action: with a value of Start a program


      • Program/script: with a value of full path to the batch script i.e. C:ScriptsWakeUpWindows.cmd

      • Start in (optional): with the value of the script directory i.e. C:Scripts


      • enter image description here





    4. From the Conditions tab be sure to set and/or check to enable options:





      • Start the task only if the computer is idle for: should be checked and have a value of 10 minutes




        • Only execute the script if the computer has been idle for 10 minutes. If the computer has not been idle for 10 minutes then likely someone has used it and the process shouldn't need to run yet.




      • Wait for idle for: with a value of 5 minutes




        • When the idle for 10 minutes condition is false this tells it keep checking for up to an additional 5 minutes and still execute the script if the 10 minute idle condition becomes true within that 5 minute window.




      • The Stop if the computer ceases to be idle option should be checked





        • If the Stop if the computer ceases to be idle condition is selected
          for a task and the task is running while the computer is in an idle
          state, then the task will stop running when the computer ceases to be
          idle.



          source





      • The Wake the computer to run this task option should be checked


      • enter image description here




      A computer is considered to be in an idle state when a screen saver is
      running. If a screen saver is not running, then the computer is
      considered to be in an idle state if there is 0% CPU usage and 0% disk
      input or output for 90% of the past fifteen minutes and if there is no
      keyboard or mouse input during this period of time. Once the Task
      Scheduler service detects that the computer is in an idle state, the
      service only waits for user input to mark the end of the idle state.



      source







    Additional Power Saving Settings




    1. From an elevated command prompt run POWERCFG -H OFF to disable hibernation just in case it’s not already disabled.



    2. Copy control /name Microsoft.PowerOptions into Run and then press Enter.



      enter image description here




    3. Click on Change plan settings for whichever Preferred plan is checked to open the Edit Plan Settings screen.



      enter image description here




    4. Be sure the Put computer to sleep value is set to Never, and then click on the Change advanced power settings option



      enter image description here




    5. From the Advanced settings find and expand Hard disk, and then set the Turn off hard disk after Setting (minutes) to a value of Never




      Note: Be sure to Apply and Save Changes where applicable




      enter image description here



    6. Open Device Manager or type in devmgmt.msc from Run and press Enter.


    7. From Device Manager expand Network adapters, right click on the main NIC (or all if you wish one-by-one) and select Properties. From the Power Management tab, uncheck the option Allow the computer to turn off the device to save power.



    enter image description here





    Further Resources




    • Scheduled Task Problems

    • FOR /L

    • SendKeys

    • Task Conditions

    • Powercfg






    share|improve this answer


























    • So this would keep the computer always on right? What I like about the answer I awarded the bounty is they pointed out the why, and the PC can still go sleep when left idle (at least until next season update with more obscure registry keys). Caffeine use similar approach with yours, they use F15 instead of spacebar to reduce intrusion, and they mentioned it even could interfere with Google Docs & Putty. But kudos to you for such detailed answer.

      – Martheen Cahya Paulo
      Oct 1 '17 at 2:49











    • @MartheenCahyaPaulo If all else fails, simply use this and perhaps it'll resolve your problem using 100% Windows native solution as a workaround. You are correct regarding the registry keys though, what that is today may be something different or in conjunction with tomorrow and thus this workaround solution I provided with detail. Again, I have two other answers with similar content that I'll be updating with some of this information as well in the near future—I'm glad I ran across the question regardless.

      – Pimp Juice IT
      Oct 1 '17 at 4:45
















    3












    3








    3







    For further solution thoroughness in case all other solutions provided do not work to keep the Windows machine from going into a power saving or sleep mode, I'll provide a workaround solution that has worked for me when no other settings could be determined to resolve it otherwise.





    Prevent Windows from Sleeping



    Note: You can still set any other power saving prevention settings I don't mention if you want.



    Creating Script Directory





    1. Create a C:Scripts and C:ScriptsTemp folder change the ScriptDir variable value to be something different if you wish and use the below command line logic to do this for you





      • Copy and paste this into command line to create the folder this way




        SET ScriptDir=C:Scripts
        IF NOT EXIST "%ScriptDir%" MD "%ScriptDir%"



      • The batch script below needs to be copied into the root of the C:Scripts folder







    Creating Batch Script





    1. This is the batch script you'll create and/or copy to the script directory you decided to use so you can automate the script execution with Task Scheduler.




      • Essentially this script uses sendkeys to emulate the pressing of the spacebar 8 times but I put the logic in a FOR /L to lessen the script logic needed.



      • @ECHO ON

        IF NOT EXIST "%~dp0Temp" MD "%~dp0Temp"
        SET TempVBSFile=%~dp0Temp~tmpSendKeysTemp.vbs
        IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"

        FOR /L %%A IN (1,1,9) DO (
        IF %%A==1 ECHO Set WshShell = WScript.CreateObject^("WScript.Shell"^)>>"%TempVBSFile%"
        IF NOT %%A==9 ECHO Wscript.Sleep 500 >>"%TempVBSFile%" & ECHO WshShell.SendKeys " ">>"%TempVBSFile%"
        )
        EXIT


      • Schedule a task with Task Scheduler using the settings as specified in the Scheduling Batch Script section







    Scheduling Batch Script



    Note: Open Task Scheduler or type in Taskschd.msc from Run and press Enter.





    1. From the General tab you will want to be sure the Run whether user is logged on or not is checked, Run with the highest privileges is checked, and that you also run the task with a credential that has local administrator privileges is you can.




      • enter image description here




    2. From the Triggers tab, define a New trigger and be sure to set options:





      • Begin the task: with a value of On a schedule


      • Start: with a time value of 12:00:00 AM


      • Settings: with the Daily value checked


      • Recur every: with a 1 day value


      • Repeat task every: with a 10 minutes value


      • For a duration of: with an Indefinitely value

      • The Enabled option should be checked


      • enter image description here





    3. From the Actions tab, define a New action and be sure to set options:





      • Action: with a value of Start a program


      • Program/script: with a value of full path to the batch script i.e. C:ScriptsWakeUpWindows.cmd

      • Start in (optional): with the value of the script directory i.e. C:Scripts


      • enter image description here





    4. From the Conditions tab be sure to set and/or check to enable options:





      • Start the task only if the computer is idle for: should be checked and have a value of 10 minutes




        • Only execute the script if the computer has been idle for 10 minutes. If the computer has not been idle for 10 minutes then likely someone has used it and the process shouldn't need to run yet.




      • Wait for idle for: with a value of 5 minutes




        • When the idle for 10 minutes condition is false this tells it keep checking for up to an additional 5 minutes and still execute the script if the 10 minute idle condition becomes true within that 5 minute window.




      • The Stop if the computer ceases to be idle option should be checked





        • If the Stop if the computer ceases to be idle condition is selected
          for a task and the task is running while the computer is in an idle
          state, then the task will stop running when the computer ceases to be
          idle.



          source





      • The Wake the computer to run this task option should be checked


      • enter image description here




      A computer is considered to be in an idle state when a screen saver is
      running. If a screen saver is not running, then the computer is
      considered to be in an idle state if there is 0% CPU usage and 0% disk
      input or output for 90% of the past fifteen minutes and if there is no
      keyboard or mouse input during this period of time. Once the Task
      Scheduler service detects that the computer is in an idle state, the
      service only waits for user input to mark the end of the idle state.



      source







    Additional Power Saving Settings




    1. From an elevated command prompt run POWERCFG -H OFF to disable hibernation just in case it’s not already disabled.



    2. Copy control /name Microsoft.PowerOptions into Run and then press Enter.



      enter image description here




    3. Click on Change plan settings for whichever Preferred plan is checked to open the Edit Plan Settings screen.



      enter image description here




    4. Be sure the Put computer to sleep value is set to Never, and then click on the Change advanced power settings option



      enter image description here




    5. From the Advanced settings find and expand Hard disk, and then set the Turn off hard disk after Setting (minutes) to a value of Never




      Note: Be sure to Apply and Save Changes where applicable




      enter image description here



    6. Open Device Manager or type in devmgmt.msc from Run and press Enter.


    7. From Device Manager expand Network adapters, right click on the main NIC (or all if you wish one-by-one) and select Properties. From the Power Management tab, uncheck the option Allow the computer to turn off the device to save power.



    enter image description here





    Further Resources




    • Scheduled Task Problems

    • FOR /L

    • SendKeys

    • Task Conditions

    • Powercfg






    share|improve this answer















    For further solution thoroughness in case all other solutions provided do not work to keep the Windows machine from going into a power saving or sleep mode, I'll provide a workaround solution that has worked for me when no other settings could be determined to resolve it otherwise.





    Prevent Windows from Sleeping



    Note: You can still set any other power saving prevention settings I don't mention if you want.



    Creating Script Directory





    1. Create a C:Scripts and C:ScriptsTemp folder change the ScriptDir variable value to be something different if you wish and use the below command line logic to do this for you





      • Copy and paste this into command line to create the folder this way




        SET ScriptDir=C:Scripts
        IF NOT EXIST "%ScriptDir%" MD "%ScriptDir%"



      • The batch script below needs to be copied into the root of the C:Scripts folder







    Creating Batch Script





    1. This is the batch script you'll create and/or copy to the script directory you decided to use so you can automate the script execution with Task Scheduler.




      • Essentially this script uses sendkeys to emulate the pressing of the spacebar 8 times but I put the logic in a FOR /L to lessen the script logic needed.



      • @ECHO ON

        IF NOT EXIST "%~dp0Temp" MD "%~dp0Temp"
        SET TempVBSFile=%~dp0Temp~tmpSendKeysTemp.vbs
        IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"

        FOR /L %%A IN (1,1,9) DO (
        IF %%A==1 ECHO Set WshShell = WScript.CreateObject^("WScript.Shell"^)>>"%TempVBSFile%"
        IF NOT %%A==9 ECHO Wscript.Sleep 500 >>"%TempVBSFile%" & ECHO WshShell.SendKeys " ">>"%TempVBSFile%"
        )
        EXIT


      • Schedule a task with Task Scheduler using the settings as specified in the Scheduling Batch Script section







    Scheduling Batch Script



    Note: Open Task Scheduler or type in Taskschd.msc from Run and press Enter.





    1. From the General tab you will want to be sure the Run whether user is logged on or not is checked, Run with the highest privileges is checked, and that you also run the task with a credential that has local administrator privileges is you can.




      • enter image description here




    2. From the Triggers tab, define a New trigger and be sure to set options:





      • Begin the task: with a value of On a schedule


      • Start: with a time value of 12:00:00 AM


      • Settings: with the Daily value checked


      • Recur every: with a 1 day value


      • Repeat task every: with a 10 minutes value


      • For a duration of: with an Indefinitely value

      • The Enabled option should be checked


      • enter image description here





    3. From the Actions tab, define a New action and be sure to set options:





      • Action: with a value of Start a program


      • Program/script: with a value of full path to the batch script i.e. C:ScriptsWakeUpWindows.cmd

      • Start in (optional): with the value of the script directory i.e. C:Scripts


      • enter image description here





    4. From the Conditions tab be sure to set and/or check to enable options:





      • Start the task only if the computer is idle for: should be checked and have a value of 10 minutes




        • Only execute the script if the computer has been idle for 10 minutes. If the computer has not been idle for 10 minutes then likely someone has used it and the process shouldn't need to run yet.




      • Wait for idle for: with a value of 5 minutes




        • When the idle for 10 minutes condition is false this tells it keep checking for up to an additional 5 minutes and still execute the script if the 10 minute idle condition becomes true within that 5 minute window.




      • The Stop if the computer ceases to be idle option should be checked





        • If the Stop if the computer ceases to be idle condition is selected
          for a task and the task is running while the computer is in an idle
          state, then the task will stop running when the computer ceases to be
          idle.



          source





      • The Wake the computer to run this task option should be checked


      • enter image description here




      A computer is considered to be in an idle state when a screen saver is
      running. If a screen saver is not running, then the computer is
      considered to be in an idle state if there is 0% CPU usage and 0% disk
      input or output for 90% of the past fifteen minutes and if there is no
      keyboard or mouse input during this period of time. Once the Task
      Scheduler service detects that the computer is in an idle state, the
      service only waits for user input to mark the end of the idle state.



      source







    Additional Power Saving Settings




    1. From an elevated command prompt run POWERCFG -H OFF to disable hibernation just in case it’s not already disabled.



    2. Copy control /name Microsoft.PowerOptions into Run and then press Enter.



      enter image description here




    3. Click on Change plan settings for whichever Preferred plan is checked to open the Edit Plan Settings screen.



      enter image description here




    4. Be sure the Put computer to sleep value is set to Never, and then click on the Change advanced power settings option



      enter image description here




    5. From the Advanced settings find and expand Hard disk, and then set the Turn off hard disk after Setting (minutes) to a value of Never




      Note: Be sure to Apply and Save Changes where applicable




      enter image description here



    6. Open Device Manager or type in devmgmt.msc from Run and press Enter.


    7. From Device Manager expand Network adapters, right click on the main NIC (or all if you wish one-by-one) and select Properties. From the Power Management tab, uncheck the option Allow the computer to turn off the device to save power.



    enter image description here





    Further Resources




    • Scheduled Task Problems

    • FOR /L

    • SendKeys

    • Task Conditions

    • Powercfg







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 30 '17 at 20:47

























    answered Sep 30 '17 at 20:39









    Pimp Juice ITPimp Juice IT

    25.2k114177




    25.2k114177













    • So this would keep the computer always on right? What I like about the answer I awarded the bounty is they pointed out the why, and the PC can still go sleep when left idle (at least until next season update with more obscure registry keys). Caffeine use similar approach with yours, they use F15 instead of spacebar to reduce intrusion, and they mentioned it even could interfere with Google Docs & Putty. But kudos to you for such detailed answer.

      – Martheen Cahya Paulo
      Oct 1 '17 at 2:49











    • @MartheenCahyaPaulo If all else fails, simply use this and perhaps it'll resolve your problem using 100% Windows native solution as a workaround. You are correct regarding the registry keys though, what that is today may be something different or in conjunction with tomorrow and thus this workaround solution I provided with detail. Again, I have two other answers with similar content that I'll be updating with some of this information as well in the near future—I'm glad I ran across the question regardless.

      – Pimp Juice IT
      Oct 1 '17 at 4:45





















    • So this would keep the computer always on right? What I like about the answer I awarded the bounty is they pointed out the why, and the PC can still go sleep when left idle (at least until next season update with more obscure registry keys). Caffeine use similar approach with yours, they use F15 instead of spacebar to reduce intrusion, and they mentioned it even could interfere with Google Docs & Putty. But kudos to you for such detailed answer.

      – Martheen Cahya Paulo
      Oct 1 '17 at 2:49











    • @MartheenCahyaPaulo If all else fails, simply use this and perhaps it'll resolve your problem using 100% Windows native solution as a workaround. You are correct regarding the registry keys though, what that is today may be something different or in conjunction with tomorrow and thus this workaround solution I provided with detail. Again, I have two other answers with similar content that I'll be updating with some of this information as well in the near future—I'm glad I ran across the question regardless.

      – Pimp Juice IT
      Oct 1 '17 at 4:45



















    So this would keep the computer always on right? What I like about the answer I awarded the bounty is they pointed out the why, and the PC can still go sleep when left idle (at least until next season update with more obscure registry keys). Caffeine use similar approach with yours, they use F15 instead of spacebar to reduce intrusion, and they mentioned it even could interfere with Google Docs & Putty. But kudos to you for such detailed answer.

    – Martheen Cahya Paulo
    Oct 1 '17 at 2:49





    So this would keep the computer always on right? What I like about the answer I awarded the bounty is they pointed out the why, and the PC can still go sleep when left idle (at least until next season update with more obscure registry keys). Caffeine use similar approach with yours, they use F15 instead of spacebar to reduce intrusion, and they mentioned it even could interfere with Google Docs & Putty. But kudos to you for such detailed answer.

    – Martheen Cahya Paulo
    Oct 1 '17 at 2:49













    @MartheenCahyaPaulo If all else fails, simply use this and perhaps it'll resolve your problem using 100% Windows native solution as a workaround. You are correct regarding the registry keys though, what that is today may be something different or in conjunction with tomorrow and thus this workaround solution I provided with detail. Again, I have two other answers with similar content that I'll be updating with some of this information as well in the near future—I'm glad I ran across the question regardless.

    – Pimp Juice IT
    Oct 1 '17 at 4:45







    @MartheenCahyaPaulo If all else fails, simply use this and perhaps it'll resolve your problem using 100% Windows native solution as a workaround. You are correct regarding the registry keys though, what that is today may be something different or in conjunction with tomorrow and thus this workaround solution I provided with detail. Again, I have two other answers with similar content that I'll be updating with some of this information as well in the near future—I'm glad I ran across the question regardless.

    – Pimp Juice IT
    Oct 1 '17 at 4:45













    0














    Just for completeness, sometimes
    the root of this problem are customized power plan settings.



    To fix it by resetting and then re-configuring your power settings, you need to:




    1. Start Menu -> Settings -> System -> Power & sleep in the left pane.

    2. In the right pane, click on Additional power settings.

    3. Select Choose when to turn off the display.

    4. Click on Change advanced power settings.

    5. Click on Restore plan defaults.


    The Power Troubleshooter can also help, accessed via :
    Start Menu -> Troubleshooting -> Improve power usage -> Power.






    share|improve this answer




























      0














      Just for completeness, sometimes
      the root of this problem are customized power plan settings.



      To fix it by resetting and then re-configuring your power settings, you need to:




      1. Start Menu -> Settings -> System -> Power & sleep in the left pane.

      2. In the right pane, click on Additional power settings.

      3. Select Choose when to turn off the display.

      4. Click on Change advanced power settings.

      5. Click on Restore plan defaults.


      The Power Troubleshooter can also help, accessed via :
      Start Menu -> Troubleshooting -> Improve power usage -> Power.






      share|improve this answer


























        0












        0








        0







        Just for completeness, sometimes
        the root of this problem are customized power plan settings.



        To fix it by resetting and then re-configuring your power settings, you need to:




        1. Start Menu -> Settings -> System -> Power & sleep in the left pane.

        2. In the right pane, click on Additional power settings.

        3. Select Choose when to turn off the display.

        4. Click on Change advanced power settings.

        5. Click on Restore plan defaults.


        The Power Troubleshooter can also help, accessed via :
        Start Menu -> Troubleshooting -> Improve power usage -> Power.






        share|improve this answer













        Just for completeness, sometimes
        the root of this problem are customized power plan settings.



        To fix it by resetting and then re-configuring your power settings, you need to:




        1. Start Menu -> Settings -> System -> Power & sleep in the left pane.

        2. In the right pane, click on Additional power settings.

        3. Select Choose when to turn off the display.

        4. Click on Change advanced power settings.

        5. Click on Restore plan defaults.


        The Power Troubleshooter can also help, accessed via :
        Start Menu -> Troubleshooting -> Improve power usage -> Power.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 29 '17 at 10:16









        harrymcharrymc

        264k14273581




        264k14273581























            -2














            Putting this here for the next person like me searching for an answer and winds up here....
            Editing the registry to enable "Sleep Unattended Sleep Timeout" setting (as mentioned above) and then changing that setting to the same sleep timeout I normally use worked for me. I found detailed instructions here: https://appuals.com/windows-10-sleeps-after-1-4-minutes-of-inactivity/






            share|improve this answer



















            • 4





              You should quote and cite your reference link, so ALL relevant information, is contained in the body of your answer.

              – Ramhound
              May 17 '17 at 22:07
















            -2














            Putting this here for the next person like me searching for an answer and winds up here....
            Editing the registry to enable "Sleep Unattended Sleep Timeout" setting (as mentioned above) and then changing that setting to the same sleep timeout I normally use worked for me. I found detailed instructions here: https://appuals.com/windows-10-sleeps-after-1-4-minutes-of-inactivity/






            share|improve this answer



















            • 4





              You should quote and cite your reference link, so ALL relevant information, is contained in the body of your answer.

              – Ramhound
              May 17 '17 at 22:07














            -2












            -2








            -2







            Putting this here for the next person like me searching for an answer and winds up here....
            Editing the registry to enable "Sleep Unattended Sleep Timeout" setting (as mentioned above) and then changing that setting to the same sleep timeout I normally use worked for me. I found detailed instructions here: https://appuals.com/windows-10-sleeps-after-1-4-minutes-of-inactivity/






            share|improve this answer













            Putting this here for the next person like me searching for an answer and winds up here....
            Editing the registry to enable "Sleep Unattended Sleep Timeout" setting (as mentioned above) and then changing that setting to the same sleep timeout I normally use worked for me. I found detailed instructions here: https://appuals.com/windows-10-sleeps-after-1-4-minutes-of-inactivity/







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 17 '17 at 21:42









            ToriponyToripony

            12




            12








            • 4





              You should quote and cite your reference link, so ALL relevant information, is contained in the body of your answer.

              – Ramhound
              May 17 '17 at 22:07














            • 4





              You should quote and cite your reference link, so ALL relevant information, is contained in the body of your answer.

              – Ramhound
              May 17 '17 at 22:07








            4




            4





            You should quote and cite your reference link, so ALL relevant information, is contained in the body of your answer.

            – Ramhound
            May 17 '17 at 22:07





            You should quote and cite your reference link, so ALL relevant information, is contained in the body of your answer.

            – Ramhound
            May 17 '17 at 22:07


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1019043%2fwindows-10-sleeps-before-set-time%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?