Schedule Task Last Run Result 0x2

3

I have a scheduled task running on Windows 7 and it returns 0x2 (according to this article, it means "access denied" and according to this article it means "an issue with the file") every time is runs.

The scheduled task runs a .BAT file. The task is set with highest privileges. The .BAT file runs successfully from the CMD.

most links in those articles are deprecated, any idea how to solve this issue?

artabaz

Posted 2017-04-19T08:05:31.807

Reputation: 51

Not sure what exactly type of batch file you are running. But if you use a shortcut of the batch file and use full paths, you can use the shortcut in the properties (via right click) run as admin. This might help. Another problem I recently ran into with a similar error, also running a batch, I went into the folder(directory of targeted files from batch) properties and increased authority to my logged-in user. – ejbytes – 2017-04-19T08:11:46.503

1

According to the official list and running net helpmsg 2 the task scheduler can't find the file you specified. This might also be reported by the batch itself if I'm not mistaken.

– Seth – 2017-04-19T08:30:51.363

Are you running the batch file in the correct directory? – DavidPostill – 2017-04-19T08:36:10.870

Yes, the batch file is in the correct directory, I can run it manually. Also it has the highest previlage, I am also the admin and it is using highest authority.

I noticed something, Once I am adding in a log using "Add Arguments" option (> failure.log), the result changes to 0x1 instead of 0x2. – artabaz – 2017-04-20T08:15:29.677

thank you @Seth for the current list and helpful command. – artabaz – 2017-04-20T08:33:37.793

Can we trigger any email action when we receive 0X2 in task scheduler? – Aakash Maurya – 2018-09-17T11:30:48.287

1@AakashMaurya I thought of same thing; I couldn't do find a way ot doing it though. – artabaz – 2018-09-19T07:41:35.573

Answers

2

I resolved the issue by calling the batchfile under "Program/Script" & set the complete absolute path in "Start In (optional):" box like below:

Program/Script: Process.cmd
Start In (optional): T:\Processing\clients\myTest

Hope this helps.

artabaz

Posted 2017-04-19T08:05:31.807

Reputation: 51

0

Another option as described here: Run .bat in Task Scheduler

Program/Script: T:\Processing\clients\myTest.bat
Start In (optional): T:\Processing\clients\

user427969

Posted 2017-04-19T08:05:31.807

Reputation: 101