Task Scheduler trigger "On disconnect from user session" does not work in Windows 10 Home?

I would like to run this simple script, that I saved in c:\windows, automatically just before I restart Windows:

I made a Basic Task in Task Scheduler with a trigger set to: "On disconnect from user session" :

If I right click on the task in the library and select the manual "Run" command it will launch the task OK (confirmed in the library) when restarting Windows but when the task is set on automatic ("Ready" in the library) nothing happens when restarting Windows.

Possibly "On disconnect from user session" has nothing to do with restarting Windows and should I use "On a Event" (Basic) trigger "Winlogon" source with a code?

Frank

[Moved from: Windows / Windows 10 / Windows settings]

|
We are volunteers willing to help you try to resolve this issue.

How to: Run PowerShell Scripts from Task Scheduler
https://community.spiceworks.com/how_to/17736-r...

PowerShell for beginners: Scripts and loops
https://www.computerworld.com/article/2879205/d...

OR

How to schedule a Batch File to run automatically in Windows 10/8/7
http://www.thewindowsclub.com/how-to-schedule-b...

How to run a batch file at a specific time
https://www.computerhope.com/issues/ch000785.htm

More support for Task Scheduler and scripting in the Microsoft TechNet
Forums.

TechNet - Windows 10 IT Pro - Forums
https://social.technet.microsoft.com/Forums/win...

Windows - PowerShell
https://social.technet.microsoft.com/Forums/Win...

Please let us know the results and if you need further assistance.
Rob Brown - past Microsoft MVP - Windows Insider MVP 2016 - 2021
Microsoft MVP Windows and Devices for IT 2009 - 2020

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Rob,

I visited most of these threads already and am running Windows 10 Home 1703 not -Pro 1709 so I don't have GPedit nor control over policies (denied, see below):

The question is with the trigger "On disconnect from user session" as I am able to run the task successfully with other triggers like Starting Windows. I am running the batch file now by right clicking on the short cut on my Desk Top, select Run as Administrator and after running click on Restart Windows. I like to do this automatic as this is clumsy and I often forget to run it when my internet times out or freezes (very slow WIFI link)

Frank

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Those methods, especially the batch file ones, do not care which version of Windows 10 you are on. Please check them out a little more carefully.
Rob Brown - past Microsoft MVP - Windows Insider MVP 2016 - 2021
Microsoft MVP Windows and Devices for IT 2009 - 2020

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I now believe this is a bug in Task Scheduler as sometimes the task starts OK at restart (not sure before or after restart) and then no more luck without changing anything! Not tried PowerShell yet, may play with that some time. For the time being I disabled my Scheduled Task (behavior far too erratic) and run my script manually.

Thanks

Frank

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Try setting a Delay in the task to see if that makes it more consistent.
Rob Brown - past Microsoft MVP - Windows Insider MVP 2016 - 2021
Microsoft MVP Windows and Devices for IT 2009 - 2020

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I already found the answer on the web:
Select the Trigger: On event
Log: System
Source: USER32
EventID: 1074
The task runs successful each time when I select restart or Shut-Down.

Frank

5 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

It works great, sometimes when restart is fast or the batch job takes more than 3 seconds it fails but this is for me the answer to my question.

Frank

 

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated May 11, 2021 Views 4,478 Applies to: