Schedule not working well on Task Scheduler

Luca Filippi 1 Reputation point
2021-07-12T10:56:47.493+00:00

Hello,

I have scheduled a job but, for some reason I don’t understand, it is not possible to “actually” run it.

Today is 12/07. As observable in the first attached screenshot, it is supposed to run every weekday at 11am. The next run time is supposed to be on 13/07. The last runtime is from 12:20 when I ran it on the Task Scheduler with right click – Run (see 2nd attached screenshot).

When I do so, or when it is run automatically according to schedule, the program is run instantaneously and the “Last Run Time” is updated accordingly. But “actually” the program is not run. I can say this because when the program is run, a log is created and files are moved from one directory to another. But when I run it through the task scheduler, the program is not actually run. If I go on SAS Enterpirise Guide, open the program and run it manually, everything works. So there is an issue with the schedule. For some reason it’s not really running it, although the runtime is updated and the status is instantaneously shown as “Running” before it becomes “Ready” again.

I will show all the configuration in case something incorrect can be identified (see last screenshots). I did the configuration based on other schedules that are working well.

Thanks,

Luca

113849-1-2021-07-12-12-41-01-classeur10-excel.png113826-2-2021-07-12-12-41-30-classeur10-excel.png113827-2021-07-12-12-41-48-classeur10-excel.png113872-2021-07-12-12-42-19-hello-word.png113864-2021-07-12-12-42-32-hello-word.png113891-2021-07-12-12-42-46-hello-word.png113892-2021-07-12-12-43-03-classeur10-excel.png113856-2021-07-12-12-51-52-classeur10-excel.png113857-2021-07-12-12-52-13-classeur10-excel.png113828-2021-07-12-12-54-02-ebesvpw441-connexion-bureau-a.png

Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2021-07-12T14:24:51.293+00:00

    The UI shows your program is running but returning 1 which means it is failing.

    The list of things that can go wrong in this particular case is long but since you said the program runs outside of TS then it narrows things down.

    • The user account that you're using has insufficient privileges to access the UNC path you gave. If admin privileges are needed then ensure the "run with highest privileges" is checked.
    • TS isn't able to use the UNC you gave (perhaps because it needs credentials) so it cannot run (try running the program directly from the UNC path from a command prompt that is running as the given user)

    Personally I would start by moving the script locally and trying again. If it works then it is a UNC issue. If it doesn't then it is potentially a user issue. Try running as whatever user you are testing the script with that currently works. If it continues to work then it is a user problem.

    If none of that helps then add some logging to your script and try running it again to narrow down where it is failing. To start with ensure there is a log message at the start of the script. If it doesn't generate that log then it is failing before it gets there. Check CScript's error reporting at that point.

    1 person found this answer helpful.
    0 comments No comments

  2. Andy YOU 3,076 Reputation points
    2021-07-13T08:41:23.077+00:00

    HI

    From your description, I think your task scheduler fail

    1.When issue happen, is there any log about our issue?
    C:\Windows\System32\winevt\Logs
    System.evtx
    application.evtx
    Microsoft-Windows-TaskScheduler%4Operational.evtx
    Microsoft-Windows-TaskScheduler%4Maintenance.evtx

    2.Please enable taskscheduler history and click the History tab to view the task's history. Click an event, in the list of events on the History tab, to view the description of the event.
    We need to check if task scheduler start fine(event id 100) and action running fine(event id 200) and complete(event id 201) for your specified task.

    Event ID 100 indicates that a scheduled task has started
    Event ID 101 is normally logged when a task fails to start.
    Event ID 102 is normally logged when a task completes successfully
    Event ID 104 indicates a logon failure.
    Event ID 106 is logged when a task is created.
    Event ID 107 is normally logged when a task is launched due to a trigger
    Event ID 110 is normally logged when a user manually launches a task
    Event ID 129 indicates the process ID of a task that has run
    Event ID 200 contains information about the action defined in the scheduled task.
    Event ID 201 action completed
    Event ID 311 indicates that a process failed to start.
    Event ID 319 indicates that the Task Engine received a message from the Task Scheduler service requesting task launch, and is the best indicator of a task launch. In these events, the Task Engine is identified by the user SID, and the task name is also logged

    In general, the normal task scheduler log like below

    114184-image.png

    0 comments No comments

  3. Luca Filippi 1 Reputation point
    2021-07-14T13:21:17.17+00:00

    Answer to JiaYou-MSFT

    Hello,

    Thanks for the clues.

    I went to the path that you suggested to check whether there are any logs. I launched the job on the task scheduler and it appears that no file is created or updated in the given directory, as observable in the attached screenshot.

    ![114599-image.png]2

    The files "System.evtx", "application.evtx", "Microsoft-Windows-TaskScheduler%4Operational.evtx" and "Microsoft-Windows-TaskScheduler%4Maintenance.evtx" have not been updated (see screenshots).

    114673-image.png

    114613-image.png

    114644-image.png

    I enabled the history, ran once the program again on Task Scheduler and here is the information that was generated (see screenshots):

    114645-image.png

    114626-image.png

    114579-image.png

    114627-image.png

    114628-image.png

    114580-image.png

    0 comments No comments

  4. Luca Filippi 1 Reputation point
    2021-07-14T15:06:40.92+00:00

    Hi all,

    While I was answering to cooldadtx, I was comparing an existing successful schedule once again with the one I was trying to make and I noticed the following difference :

    114615-image.png

    I was then able to run the program via task scheduler.

    114693-image.png

    So it seems I found the issue.

    I will check that the program is run automatically tomorrow at 11 am and if it's the case, the question is closed.

    Thank you guys for the information, it was very instructive.

    0 comments No comments

  5. Luca Filippi 1 Reputation point
    2021-07-15T10:30:58.597+00:00

    Ok, it works.

    Thanks for your suggestions.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.