Win10 Scheduled wake up doesn't work if sleep is initiated from script Solved

Page 1 of 2 12 LastLast

  1. Posts : 8
    Windows 10, Ubuntu 18.04
       #1

    Win10 Scheduled wake up doesn't work if sleep is initiated from script


    I want my computer to go into sleep mode at time x and wake up automatically at time y. I have created a sleep task and a wake up task in the task scheduler and disabled hibernation mode.

    When I initiate sleep manually via the start menu, the computer seems to wake up reliably (additional testing required). However, when I use a batch file with the following content, the computer never wakes up:

    Code:
    rundll32.exe powrprof.dll,SetSuspendState 0,1,0
    Do you have any suggestions what could be the reason for this behavior and what I could do to fix it?

    Thank you!
      My ComputerSystem Spec

  2.    #2

    See if this helps:

    Sleep mode command line doesn't work with Windows 10 anymore ?

    In particular, make sure that hibernation is disabled AND run the this command:

    Code:
    powercfg -h off
      My ComputerSystem Spec


  3. Posts : 8
    Windows 10, Ubuntu 18.04
    Thread Starter
       #3

    hsehestedt said: View Post
    See if this helps:

    Sleep mode command line doesn't work with Windows 10 anymore ?

    In particular, make sure that hibernation is disabled AND run the this command:

    Code:
    powercfg -h off
    I just tried this again. Unfortunately, no change. The computer is still stuck in sleep and I have to press a button to wake it up again.

    Code:
    Microsoft Windows [Version 10.0.17763.503]
    (c) 2018 Microsoft Corporation. Alle Rechte vorbehalten.
    
    C:\WINDOWS\system32>powercfg -a
    Die folgenden Standbymodusfunktionen sind auf diesem System verfügbar:
        Standby (S3)
    
    Die folgenden Standbymodusfunktionen sind auf diesem System nicht verfügbar:
        Standby (S1)
            Die Systemfirmware unterstützt diesen Standbystatus nicht.
    
        Standby (S2)
            Die Systemfirmware unterstützt diesen Standbystatus nicht.
    
        Ruhezustand
            Ruhezustand wurde nicht aktiviert.
    
        Standby (S0 Niedriger Energiestand – Leerlauf)
            Dieser Standbyzustand wird von der Systemfirmware nicht unterstützt.
    
        Hybrider Standbymodus
            Der Ruhezustand ist nicht verfügbar.
    
        Schnellstart
            Der Ruhezustand ist nicht verfügbar.
    - - - Updated - - -

    Nobody? I'm surprised that I can't find more online about this. It's such a commonly used function.
      My ComputerSystem Spec

  4. Try3's Avatar
    Posts : 2,010
    Windows 10 Home x64 and Pro x86
       #4

    Perhaps some of the other TenForum threads on the subject can shed some light on the problem.

    Personally, I gave up and installed NirSoft's NirCmd to be able to use the sleep command nircmd.exe standby instead. Perhaps NirCmd would solve your problem as well.

    Denis
      My ComputerSystem Spec


  5. Posts : 8
    Windows 10, Ubuntu 18.04
    Thread Starter
       #5

    Try3 said: View Post
    Perhaps some of the other TenForum threads on the subject can shed some light on the problem.

    Personally, I gave up and installed NirSoft's NirCmd to be able to use the sleep command nircmd.exe standby instead. Perhaps NirCmd would solve your problem as well.

    Denis
    Thank you!

    I tried NirCmd, but unfortunately, the computer also doesn't wake up if I inititate the standby mode this way. It's frustrating how unreliable such a basic functionality of Windows is.
      My ComputerSystem Spec

  6. Try3's Avatar
    Posts : 2,010
    Windows 10 Home x64 and Pro x86
       #6

    I find your problem rather mysterious. I can only speculate but perhaps this is a bug that nobody else has reported before.

    If you post your wakeup task then I will test my own computers to see how they react.
    3 computers - Windows 10 Home x64 Version 1903 Build 18362.145
    1 computer - Windows 10 Pro x86 Version 1709

    Notes
    1 I believe Ruhezustand means Hibernation. I leave mine activated.
    2 I have not seen a computer on which Fast start was not available but I cannot see that affecting the situation.
    3 I have one computer on which Hybrid sleep is not available so, whilst I cannot see it being relevant, I'll be able to test for that.

    Denis
      My ComputerSystem Spec



  7. Posts : 8
    Windows 10, Ubuntu 18.04
    Thread Starter
       #7

    Thank you Denis, you're awesome!

    Just to make sure we are on the same page:

    - Hibernation - Ruhezustand -> Computer writes current state to hard drive, shuts off, power loss doesn't lead to loss of data
    - Sleep - Energie sparen -> Computer keeps current state in memory, shuts down other components, power loss leads data loss

    I have been trying to get sleep mode to work, but I would be even happier with hibernation mode.

    The main purpose I want the computer to wake up at time X is that I want to be able to remote control it from a different computer with VNC/Teamviewer within minutes or hours after the wake up. The script I'm executing to wake up the computer is a simple Python script that writes a timestamp to a file every time it's executed, but since it doesn't matter for my purpose, I'm fine with anything that works. :)

    I attached screenhots of my settings:

    Click image for larger version. 

Name:	1.PNG 
Views:	13 
Size:	20.8 KB 
ID:	236802Click image for larger version. 

Name:	2.PNG 
Views:	13 
Size:	12.2 KB 
ID:	236803Click image for larger version. 

Name:	3.PNG 
Views:	13 
Size:	14.1 KB 
ID:	236804Click image for larger version. 

Name:	4.PNG 
Views:	13 
Size:	22.5 KB 
ID:	236805Click image for larger version. 

Name:	5.PNG 
Views:	13 
Size:	21.9 KB 
ID:	236806
      My ComputerSystem Spec

  8. Try3's Avatar
    Posts : 2,010
    Windows 10 Home x64 and Pro x86
       #8

    - Hibernation - Ruhezustand -> Computer writes current state to hard drive, shuts off, power loss doesn't lead to loss of data
    - Sleep - Energie sparen -> Computer keeps current state in memory, shuts down other components, power loss leads data loss
    Yes. {and you'll often see Sleep referred to as Suspend or Standby because those were the names used in early OSes}

    I would be even happier with hibernation mode
    Even though it has still not been documented anywhere, Task scheduler will only wake computers up from Hibernation if the AC power is connected.

    The script I'm executing to wake up the computer is a simple Python script
    I do not have Python & know nothing about it but since we are considering the task settings rather than the action taken by the task I don't think that matters. I'll just set up a wakeup task that opens Notepad or something simple.

    Allgemein, Sicherheitsoptionen
    Please run a test concerning the General tab, Security options setting.
    For the purposes of testing, temporarily change the task to run only when the user is logged on & clear the highest privileges setting.
    That might mean you have to temporarily change the task Action to something else [such as opening Notepad] but that will be sufficient to see if that run whether user logged on or not is affecting your results.

    Verlauf (deaktiviert)
    Enable All tasks history [it is in the right-hand set of options in the Task scheduler window].
    For all we know, Task scheuler might then be able to report something that will solve the mystery.

    All your other task settings are the same as a task I have that wakes up the computer successfully. I have never tried using a script to sleep it before.

    I'm tied up for a couple of days so will post my test results on Thursday.

    Denis
      My ComputerSystem Spec

  9. Try3's Avatar
    Posts : 2,010
    Windows 10 Home x64 and Pro x86
       #9

    I tested 2 computers. They both woke correctly when put to sleep / hibernation using these methods
    1 Sleep test - Settings, Power, Sleep
    2 Sleep test - Power button [which was set to send it to Sleep]
    3 Sleep test - Batch file C:\Tools\External\NirSoft\NirCmd\x64\NirCmd.exe standby
    4 Hibernation test - Batch file C:\Windows\System32\shutdown.exe /h
    [[both computers were connected to AC power throughout - it was only essential for test 4]]

    Both computers support
    - Sleep state S3 [Sleep is turned on {activated} at Control panel, Power options, Choose what the power buttons do]
    - Hibernate [which is turned on {activated} at Control panel, Power options, Choose what the power buttons do]
    - Hybrid sleep [which is turned off at Control panel, Power options, {active power plan}, Change advanced power settings, Sleep, Allow hybrid sleep]
    - Fast startup [which is turned off at Control panel, Power options, Choose what the power buttons do]

    The significant settings on each Task scheduler tab were:-
    General tab - Run only when user is logged on, {Run with highest privileges was off}
    Conditions tab - Wake the computer to run this task
    and I suggest that you test your computer using the same settings
    - I think your problem might turn out to be something to do with those on the General tab
    - Do remember to turn on All tasks history in case it contains useful info

    I had intended to test a third computer that supports
    - Standby S0 {”Modern standby” - more or less like a mobile phone being idle yet instantly available for use}
    - Hibernate
    - Fast startup
    but it has chosen today to have a defective cmos battery and its time stops when I hibernate it so it cannot wake up any circumstances. I always knew it was a risk buying a tablet-with-its-own-keyboard and its now 2 months out of warranty so I’ll have to pay somebody to replace the cmos.

    Denis
      My ComputerSystem Spec


  10. Posts : 8
    Windows 10, Ubuntu 18.04
    Thread Starter
       #10

    I finally had the time to test all of your suggestions. I can make it short: It works fine now! Even in hibernation mode (since I'm using a desktop, AC will always be connected).

    Thank you so much for your help, Denis! You went above and beyond to help me find the root of the problem. After spending way too many hours on this issue, I was close to giving up. I really appreciate your detailed explanations.
      My ComputerSystem Spec


 
Page 1 of 2 12 LastLast

Related Threads
Been going on for a couple of weeks now. First, I had to add this: because I have a display port connected monitor, I this program (Turn off your notebook LCD with one-click | Redmond Pie) to put my monitors to sleep instead of switching them...
After an upgrade to Windows 10, my HP Compaq 6005 Pro Small Form Factor will not wake up properly from sleep. After sleep, if I press a key on the keyboard or press the power button, I hear the fan and hard drive start up, and the monitor goes from...
Came across my first major problem. When I try to go into sleep mode (either through the Start menu or pressing the power button), the hard drive light blinks for a second then the screen goes black. BUT... my power light stays on (should be...
Find "Wake up from sleep" Scheduled Tasks in Performance & Maintenance
Other than going through each and every task in the task scheduler, is there a way to see those that are allowed to wake the machine while it is sleeping? My PC woke up this morning at 3:30 am. It then went back to sleep about ten minutes later. ...
When I put my laptop to sleep and then attempt to wake it up, it will power on (going through the boot up screens) instead of just waking up, thus causing me to lose any information open on the computer. I have tried a few things to try to wake...
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

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