简体   繁体   中英

Task scheduler doesn't work when select “Run whether user is logged in or not”

We are using WebBrowser control to download a certain file in console application. We scheduled this console application in task scheduler with this selected option "Run only user is logged on", its working fine. But we scheduled this for "Run whether user is logged in or not". It will not work. We couldn't see any error in command prompt. Can any faced this scenario?

If an application is set to run whether the user is logged in or not, no user interface will be displayed. See here:

https://social.technet.microsoft.com/Forums/windows/en-US/c03d6691-b058-4f8d-961c-e8eba25bbaed/task-scheduler-problem-run-whether-user-is-logged-on-or-not?forum=w7itprogeneral

An easy proof of this would be to write to a logfile when the application is launched. If the file is created at the expected time, then the task scheduler is working correctly and the application is being run.

Regarding your comment below

its only working in machine turned on, otherwise not working

If you have the machine turned off at the scheduled time of the task, it will not run. It can be logged out, but the machine does in fact need to be turned on. Your comment makes this seem like the cause.

I faced the same issue and I resolved the issue by the following steps.

  1. Give only the file name in Program/Script field in actions tab and the path of your script in the Start-in field. In this way if you have any log files, Then you see that they are being created in the same directory.
  2. When you say the script has to run even when user is not logged in, then the packages that you installed specific for the user cannot be used in your script For eg: If you have installed a python library for a specific user(ie in C:\\users folder) then you cannot use those packages in your python script that is going to be scheduled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM