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

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 Computer


  2. Posts : 4,169
    Windows 11 Pro, 22H2
       #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 Computers


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

    hsehestedt said:
    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 Computer


  4. Posts : 16,712
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #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 Computer


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

    Try3 said:
    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 Computer


  6. Posts : 16,712
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #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 Computer


  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:

    Win10 Scheduled wake up doesn't work if sleep is initiated from script-1.pngWin10 Scheduled wake up doesn't work if sleep is initiated from script-2.pngWin10 Scheduled wake up doesn't work if sleep is initiated from script-3.pngWin10 Scheduled wake up doesn't work if sleep is initiated from script-4.pngWin10 Scheduled wake up doesn't work if sleep is initiated from script-5.png
      My Computer


  8. Posts : 16,712
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #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 Computer


  9. Posts : 16,712
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #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 Computer


  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 Computer


 

  Related Discussions
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 22:01.
Find Us




Windows 10 Forums