How can I make Windows Task Scheduler fire an event when there's a change of power source detected?Sage 50...

Can I solder 12/2 Romex to extend wire 5 ft?

Would the melodic leap of the opening phrase of Mozart's K545 be considered dissonant?

Why is it "take a leak?"

I can't die. Who am I?

Is every open circuit a capacitor?

Can the Shape Water Cantrip be used to manipulate blood?

Plagiarism of code by other PhD student

Is there any relevance to Thor getting his hair cut other than comedic value?

I encountered my boss during an on-site interview at another company. Should I bring it up when seeing him next time?

Caulking a corner instead of taping with joint compound?

Why are special aircraft used for the carriers in the United States Navy?

What is a term for a function that when called repeatedly, has the same effect as calling once?

Find maximum of the output from reduce

I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?

When to use mean vs median

Formatting a table to look nice

Canadian citizen, on US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

Are small insurances worth it

Where is the fallacy here?

Where is this quote about overcoming the impossible said in "Interstellar"?

School performs periodic password audits. Is my password compromised?

Practical reasons to have both a large police force and bounty hunting network?

How do we objectively assess if a dialogue sounds unnatural or cringy?

GPL code private and stolen



How can I make Windows Task Scheduler fire an event when there's a change of power source detected?


Sage 50 Accounts 2010 wont run on windows 7Windows Task Scheduler on File changeBlack screen and WHEA logger ID 18Unload User Data in Windows 10Windows 10 goes to sleep ignoring the settingsLaptop goes to sleep at random times ever since I upgraded it to Windows 10Pressing right alt causes shutdownWindows Task Scheduler not running task on eventDell desktop falls asleep in a couple minutes, ignores power/screen saver settingswindows task scheduler event on external ip change













1















I've written a script that successfully sends me a Telegram message describing the battery state of my PC.



I'd like Task Scheduler to run the script when the power source changes, so that when the power at home dies, I know that my fridge is in danger of defrosting etc. etc.



What I've done to achieve this:




  • Opened Event Viewer

  • Found the event under Windows Logs -> System, Source is "Kernel-Power"

  • Clicked "Attach Task To This Event"

  • Set up the task and successfulyl run it manually from Task Scheduler


My problem is that the task does not fire when the computer switches to battery. It does fire when the computer switches back to mains, which doesn't help me!



I've made sure to turn off the default tickbox of "Start the task if the computer is on AC power", so I'd expect the task to fire in all circumstances.



I've also set it to "Run whether the user is logged on or not", though I'm nearly always logged on.



The events look pretty similar from the event log, but this one fires:



<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
<EventID>105</EventID>
<Version>1</Version>
<Level>4</Level>
<Task>100</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000404</Keywords>
<TimeCreated SystemTime="2019-03-05T17:21:55.021810500Z" />
<EventRecordID>75824</EventRecordID>
<Correlation />
<Execution ProcessID="4" ThreadID="336" />
<Channel>System</Channel>
<Computer>Matthew-PC</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData>
<Data Name="AcOnline">true</Data>
<Data Name="RemainingCapacity">68</Data>
<Data Name="FullChargeCapacity">100</Data>
</EventData>
</Event>


and this one doesn't:



<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
<EventID>105</EventID>
<Version>1</Version>
<Level>4</Level>
<Task>100</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000404</Keywords>
<TimeCreated SystemTime="2019-03-05T17:21:44.661890000Z" />
<EventRecordID>75823</EventRecordID>
<Correlation />
<Execution ProcessID="4" ThreadID="336" />
<Channel>System</Channel>
<Computer>Matthew-PC</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData>
<Data Name="AcOnline">false</Data>
<Data Name="RemainingCapacity">68</Data>
<Data Name="FullChargeCapacity">100</Data>
</EventData>
</Event>


So does anyone know why the task doesn't fire? It feels like a power saving measure somewhere else in Windows but I can't work it out (something hidden in the power scheme??)










share|improve this question









New contributor




Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    1















    I've written a script that successfully sends me a Telegram message describing the battery state of my PC.



    I'd like Task Scheduler to run the script when the power source changes, so that when the power at home dies, I know that my fridge is in danger of defrosting etc. etc.



    What I've done to achieve this:




    • Opened Event Viewer

    • Found the event under Windows Logs -> System, Source is "Kernel-Power"

    • Clicked "Attach Task To This Event"

    • Set up the task and successfulyl run it manually from Task Scheduler


    My problem is that the task does not fire when the computer switches to battery. It does fire when the computer switches back to mains, which doesn't help me!



    I've made sure to turn off the default tickbox of "Start the task if the computer is on AC power", so I'd expect the task to fire in all circumstances.



    I've also set it to "Run whether the user is logged on or not", though I'm nearly always logged on.



    The events look pretty similar from the event log, but this one fires:



    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
    <EventID>105</EventID>
    <Version>1</Version>
    <Level>4</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000404</Keywords>
    <TimeCreated SystemTime="2019-03-05T17:21:55.021810500Z" />
    <EventRecordID>75824</EventRecordID>
    <Correlation />
    <Execution ProcessID="4" ThreadID="336" />
    <Channel>System</Channel>
    <Computer>Matthew-PC</Computer>
    <Security UserID="S-1-5-18" />
    </System>
    <EventData>
    <Data Name="AcOnline">true</Data>
    <Data Name="RemainingCapacity">68</Data>
    <Data Name="FullChargeCapacity">100</Data>
    </EventData>
    </Event>


    and this one doesn't:



    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
    <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
    <EventID>105</EventID>
    <Version>1</Version>
    <Level>4</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8000000000000404</Keywords>
    <TimeCreated SystemTime="2019-03-05T17:21:44.661890000Z" />
    <EventRecordID>75823</EventRecordID>
    <Correlation />
    <Execution ProcessID="4" ThreadID="336" />
    <Channel>System</Channel>
    <Computer>Matthew-PC</Computer>
    <Security UserID="S-1-5-18" />
    </System>
    <EventData>
    <Data Name="AcOnline">false</Data>
    <Data Name="RemainingCapacity">68</Data>
    <Data Name="FullChargeCapacity">100</Data>
    </EventData>
    </Event>


    So does anyone know why the task doesn't fire? It feels like a power saving measure somewhere else in Windows but I can't work it out (something hidden in the power scheme??)










    share|improve this question









    New contributor




    Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      1












      1








      1








      I've written a script that successfully sends me a Telegram message describing the battery state of my PC.



      I'd like Task Scheduler to run the script when the power source changes, so that when the power at home dies, I know that my fridge is in danger of defrosting etc. etc.



      What I've done to achieve this:




      • Opened Event Viewer

      • Found the event under Windows Logs -> System, Source is "Kernel-Power"

      • Clicked "Attach Task To This Event"

      • Set up the task and successfulyl run it manually from Task Scheduler


      My problem is that the task does not fire when the computer switches to battery. It does fire when the computer switches back to mains, which doesn't help me!



      I've made sure to turn off the default tickbox of "Start the task if the computer is on AC power", so I'd expect the task to fire in all circumstances.



      I've also set it to "Run whether the user is logged on or not", though I'm nearly always logged on.



      The events look pretty similar from the event log, but this one fires:



      <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
      <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
      <EventID>105</EventID>
      <Version>1</Version>
      <Level>4</Level>
      <Task>100</Task>
      <Opcode>0</Opcode>
      <Keywords>0x8000000000000404</Keywords>
      <TimeCreated SystemTime="2019-03-05T17:21:55.021810500Z" />
      <EventRecordID>75824</EventRecordID>
      <Correlation />
      <Execution ProcessID="4" ThreadID="336" />
      <Channel>System</Channel>
      <Computer>Matthew-PC</Computer>
      <Security UserID="S-1-5-18" />
      </System>
      <EventData>
      <Data Name="AcOnline">true</Data>
      <Data Name="RemainingCapacity">68</Data>
      <Data Name="FullChargeCapacity">100</Data>
      </EventData>
      </Event>


      and this one doesn't:



      <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
      <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
      <EventID>105</EventID>
      <Version>1</Version>
      <Level>4</Level>
      <Task>100</Task>
      <Opcode>0</Opcode>
      <Keywords>0x8000000000000404</Keywords>
      <TimeCreated SystemTime="2019-03-05T17:21:44.661890000Z" />
      <EventRecordID>75823</EventRecordID>
      <Correlation />
      <Execution ProcessID="4" ThreadID="336" />
      <Channel>System</Channel>
      <Computer>Matthew-PC</Computer>
      <Security UserID="S-1-5-18" />
      </System>
      <EventData>
      <Data Name="AcOnline">false</Data>
      <Data Name="RemainingCapacity">68</Data>
      <Data Name="FullChargeCapacity">100</Data>
      </EventData>
      </Event>


      So does anyone know why the task doesn't fire? It feels like a power saving measure somewhere else in Windows but I can't work it out (something hidden in the power scheme??)










      share|improve this question









      New contributor




      Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I've written a script that successfully sends me a Telegram message describing the battery state of my PC.



      I'd like Task Scheduler to run the script when the power source changes, so that when the power at home dies, I know that my fridge is in danger of defrosting etc. etc.



      What I've done to achieve this:




      • Opened Event Viewer

      • Found the event under Windows Logs -> System, Source is "Kernel-Power"

      • Clicked "Attach Task To This Event"

      • Set up the task and successfulyl run it manually from Task Scheduler


      My problem is that the task does not fire when the computer switches to battery. It does fire when the computer switches back to mains, which doesn't help me!



      I've made sure to turn off the default tickbox of "Start the task if the computer is on AC power", so I'd expect the task to fire in all circumstances.



      I've also set it to "Run whether the user is logged on or not", though I'm nearly always logged on.



      The events look pretty similar from the event log, but this one fires:



      <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
      <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
      <EventID>105</EventID>
      <Version>1</Version>
      <Level>4</Level>
      <Task>100</Task>
      <Opcode>0</Opcode>
      <Keywords>0x8000000000000404</Keywords>
      <TimeCreated SystemTime="2019-03-05T17:21:55.021810500Z" />
      <EventRecordID>75824</EventRecordID>
      <Correlation />
      <Execution ProcessID="4" ThreadID="336" />
      <Channel>System</Channel>
      <Computer>Matthew-PC</Computer>
      <Security UserID="S-1-5-18" />
      </System>
      <EventData>
      <Data Name="AcOnline">true</Data>
      <Data Name="RemainingCapacity">68</Data>
      <Data Name="FullChargeCapacity">100</Data>
      </EventData>
      </Event>


      and this one doesn't:



      <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
      <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331c3b3a-2005-44c2-ac5e-77220c37d6b4}" />
      <EventID>105</EventID>
      <Version>1</Version>
      <Level>4</Level>
      <Task>100</Task>
      <Opcode>0</Opcode>
      <Keywords>0x8000000000000404</Keywords>
      <TimeCreated SystemTime="2019-03-05T17:21:44.661890000Z" />
      <EventRecordID>75823</EventRecordID>
      <Correlation />
      <Execution ProcessID="4" ThreadID="336" />
      <Channel>System</Channel>
      <Computer>Matthew-PC</Computer>
      <Security UserID="S-1-5-18" />
      </System>
      <EventData>
      <Data Name="AcOnline">false</Data>
      <Data Name="RemainingCapacity">68</Data>
      <Data Name="FullChargeCapacity">100</Data>
      </EventData>
      </Event>


      So does anyone know why the task doesn't fire? It feels like a power saving measure somewhere else in Windows but I can't work it out (something hidden in the power scheme??)







      windows windows-10 power-management scheduled-tasks event-log






      share|improve this question









      New contributor




      Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited yesterday









      Nathan.Eilisha Shiraini

      2,4331923




      2,4331923






      New contributor




      Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      Matthew BlochMatthew Bloch

      1063




      1063




      New contributor




      Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Matthew Bloch is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          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
          });


          }
          });






          Matthew Bloch is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1411543%2fhow-can-i-make-windows-task-scheduler-fire-an-event-when-theres-a-change-of-pow%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Matthew Bloch is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Matthew Bloch is a new contributor. Be nice, and check out our Code of Conduct.













          Matthew Bloch is a new contributor. Be nice, and check out our Code of Conduct.












          Matthew Bloch is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f1411543%2fhow-can-i-make-windows-task-scheduler-fire-an-event-when-theres-a-change-of-pow%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

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

          looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...