1

Deprecated solution: Only works in earlier Windows versions than Windows 10

Taken from: Run a script when Windows resumes from suspend/hibernate state?

On an event - In the system log, the "Power-Troubleshooter" Source will log an event code of 1 when you wake up from a sleep state.


Possible explanation of the Windows 10 behaviour:

The default handling in Windows 10 is that shut down is treated as hibernate, so start up resumes from hibernation and does not start from scratch, as restart does - @AFH


I have tested that, Only on a restart of the Windows 10 operating system would trigger action that I have made.

Even if I chose Trigger to be At startup, it seems that task does not detect that Windows 10 were started up.

I'm using Windows 10 Home version.

Where could I get some help?


Testing results I provided:

Last run results: 0x103

Exported Task I used for testing: Chrome Preload.xml

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2017-06-21T13:05:39.6050683</Date>
    <Author>DESKTOP-6519MDL\vaida</Author>
    <URI>\Chrome preload</URI>
  </RegistrationInfo>
  <Triggers>
    <BootTrigger>
      <Enabled>true</Enabled>
    </BootTrigger>
    <EventTrigger>
      <Enabled>true</Enabled>
      <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="System"&gt;&lt;Select Path="System"&gt;*[System[Provider[@Name='Power-Troubleshooter'] and EventID=1]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
    </EventTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-1438360845-2802100473-3542379989-1002</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>true</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT30S</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"</Command>
    </Exec>
  </Actions>
</Task>
fixer1234
  • 27,064
  • 61
  • 75
  • 116
user3789797
  • 111
  • 4
  • What's the last execution result for the task? How did you verify this? What does the setup for the task look like? What kind of behavior have you set for "restarting"? – Seth Jun 21 '17 at 11:22
  • The default handling in Windows 10 is that shut down is treated as hibernate, so start up resumes from hibernation and does not start from scratch, as restart does. – AFH Jun 21 '17 at 11:41
  • @AFH That's exactly what I do think. – user3789797 Jun 21 '17 at 11:44
  • 1
    Normally start-up tasks are used to initiate certain processes after a cold boot, but these should still be running after hibernation, so you wouldn't expect them to be invoked again. – AFH Jun 21 '17 at 11:47
  • @Seth Thread has been updated. – user3789797 Jun 21 '17 at 11:50
  • @AFH Going to use your insights as Summary of the thread from now on. – user3789797 Jun 21 '17 at 11:53
  • 1
    [This question](https://superuser.com/questions/276054/run-a-script-when-windows-resumes-from-suspend-hibernate-state) offers solutions for running a task on resuming from hibernation. – AFH Jun 21 '17 at 12:01
  • @AFH Have been tested before, you can check my configuration file I posted at the end of the thread. (Chrome Preload.xml) – user3789797 Jun 21 '17 at 12:17
  • I noticed from the settings tab you have this setup to `Stop the task if it runs longer than 30 seconds`, uncheck that option and see if it makes any difference. I also noticed from the `Actions` properties you have nothing in the `start in:` field so try adding `"C:\Program Files (x86)\Google\Chrome\Application"` to that. Additionally you might consider using the **Trigger** `on workstation unlock` & test to see if that gives you the expected behavior. Check out https://superuser.com/questions/1214736/windows-10-scheduled-tasks-with-workstation-lock-unlock-not-being-triggered/1217125#1217125 – Vomit IT - Chunky Mess Style Jun 21 '17 at 12:25
  • "Stop the task if it runs longer than 30 seconds", it's a conscious decision, I have made this so that it shut down the chrome after it is loaded. I need for the Chrome to be loaded before I even start to type the password for the login. The configurations are fully working, the only thing that does not work is Windows 10 do not handle Startup as a startup anymore, it's a technical bug made by Microsoft. At least from my guess. Maybe going to try "on workstation unlock" later on, but that's not exactly what I need, although it may be helpful anyway. – user3789797 Jun 21 '17 at 12:34
  • Chrome will not load before you login. What are you actually trying to achieve? – Seth Jun 21 '17 at 12:44
  • @Seth As configuration file "Chrome Preload.xml" says, I want to preload application so that later on I could quickly get into working with that application I preloaded. I haven't experimented enough to make the conclusion that it is not possible. Anyways, even the on login might be better than nothing. So I'm heading towards it if actually does not load before login. – user3789797 Jun 21 '17 at 12:56
  • As I implied previously, Chrome should already be running when you resume, so there will be no need for pre-load under these circumstances. – AFH Jun 21 '17 at 13:58
  • I do not need preload when Windows come back from sleep. I only need it when windows starting up after a shutdown or restart, I do understand it. Due to the bug mentioned before it is hard to achieve. The restart one works, while shutting down and loading windows in does not. – user3789797 Jun 21 '17 at 14:09

0 Answers0