How to fix Windows Scheduled Task not working?

In the process of deploying our .net application, I have about 20 scheduled tasks configured on the server, all of which basically do the same thing: call a small .net console application that retrieves data from SQL db and sends it to the web service. Each task invokes a separate copy of the application, with each copy having a different search identifier value in its configuration file.

All but two tasks are performed reliably every night. Two of the tasks seem to randomly interrupt from time to time, and this is currently a mystery about why. When they stop working, the scheduled task interface correctly displays its latest execution date, which is one day or more for other tasks that continue at the scheduled time. Tasks that have stopped working do not start again on their own, even though they are listed as scheduled to run every night. There are no errors in the event log or in the interface of the scheduled task. And here’s the weirdest part for us: if I manually start a scheduled task, it works fine, it calls the .net console application, and everything ends without anomalies. And then it continues to function normally at the appointed time, for several days or weeks at a time, but only ultimately fails, it would seem, not in the blue. Both tasks seem to always crash that very night.

+12
windows scheduled-tasks
source share
9 answers

There is a column "Last Result", which should give you the code associated with the launched task (it will not contain any data on exceptions). 0 means the task completed without errors. You can see something else and see why the task does not begin. If the task still does not work, but you still see 0 for the last result, it means that something is broken in your code, but it exits gracefully.

+9
source share

Taskscheduler suggests that on 64-bit systems the application should be 64 bits. If this is a 32-bit run from a 32-bit command line, that is, if you want to run c: \ program files (x86) \ Myprogram \ Program.exe, tell taskcheduler to start:

  • % systemroot% \ Syswow64 \ cmd.exe / C "c: \ program files (x86) \ Myprogram \ Program.exe"

This forces it to run from a 32-bit command line and, therefore, with 32-bit emulation.

+4
source share

Have you set the Start to property?

If you need the app.config file or some files located in their path for these .NET console applications, you should set the β€œStart at” property to β€œc: \ your \ app \ path", otherwise they will start as if they were to the system directory and they cannot find the files you need!

+3
source share

One of the reasons for the failure to complete scheduled tasks when combining them with a user account without a password: by default, scheduled tasks are not allowed to run with an empty password. If you want to run a scheduled task from an account without a password, you need to disable the system variable:

  • Go to: Start> Administrative Tools> Local Security Policy> Security Settings> Local Policies> Security Settings
  • Select: "Accounts: Limit the use of blank passwords on the local account to log into the console."
  • Disable this variable

Disclaimer: It is not recommended to have accounts without a password.

+1
source share

In my case, the scheduled task will not be executed, although he said that the last run was successful (0). It turned out that the Windows user account that was running the tasks was locked. I realized this only because I tried to edit the existing scheduled task, set the user account to the same, and then click "OK", and this gave me an error in blocking the account.

+1
source share

I found this very useful link : https://windowsreport.com/windows-scheduled-tasks-not-running/ for thorough debugging in many cases.

In my case, the user account for which the scheduler was configured was blocked, which stopped the execution of scheduled tasks without any logs or reporting problems.

enter image description here

+1
source share

Maybe they hung and still fled?

You can click on the additional menu and select an entry in the menu to view the log, then notepad will open the log file from the task scheduler

0
source share

I found this page useful when I tried to deal with the error. Scheduled task:
http://support.microsoft.com/kb/308558

Select View-> Details to display additional information such as Last Run Time and Status, and this page gave me the meaning of the status / error code:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx

0
source share

The answer to the following SO question can also be very important for people reading this question (but, NB, it describes only one possible specific problem with the planned tasks, and I believe that none of these questions is a duplicate of the other):

Why is my scheduled task updating its "last run time" correctly and giving the "last run result" from "(0x0)" but still not working?

A summary of the answer given to this other question is that Windows 2012 scheduled tasks do not display the correct environment variables, including PATH, for the account for which the task runs as.

From the point of view of more general troubleshooting for a task schedule (as asked in this question), you can check for this specific problem (for example, run SET > test.txt in a task, as suggested in this answer), and as soon as you can see it it can happen if it affects you.

0
source share

All Articles