question

LucaF-4129 avatar image
0 Votes"
LucaF-4129 asked JiaYou-MSFT edited

Schedule not working well on Task Scheduler

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-server
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JiaYou-MSFT avatar image
0 Votes"
JiaYou-MSFT answered

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



image.png (85.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LucaF-4129 avatar image
0 Votes"
LucaF-4129 answered

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



[2]: /answers/storage/attachments/114578-image.png


image.png (93.3 KiB)
image.png (21.4 KiB)
image.png (21.9 KiB)
image.png (45.6 KiB)
image.png (149.4 KiB)
image.png (177.2 KiB)
image.png (183.1 KiB)
image.png (176.2 KiB)
image.png (165.9 KiB)
image.png (167.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LucaF-4129 avatar image
0 Votes"
LucaF-4129 answered

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.



image.png (142.2 KiB)
image.png (95.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LucaF-4129 avatar image
0 Votes"
LucaF-4129 answered JiaYou-MSFT edited

Ok, it works.

Thanks for your suggestions.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

HI

I am glad to hear that your issue has been solved, If there is any the answer helpful for you, please click "Accept Answer" and upvote it. Thanks for your cooperation.

============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 Votes 0 ·