Forum Discussion
Task Scheduler on Windows Server - 0x2 error
Hello DavidYorkshire,
I hope you are doing well!
There is no need for you to worry about a 0x2 error in the task scheduler. It's quite easy to fix it. However, you will have to follow the below steps to encounter the task scheduler issue.
The task scheduler executes the .cmd or .bat files, which have to be performed with the administrator's help. The administrator gives access to the administrative rights to run the tasks from the assigned account to save time from scheduling them daily. However, even if the rights have been given, sometimes it fails to perform the duty. As a result, the last run result of 0x2 failed because access had been denied.
In order to fix the issue, firstly, we need to know the cause of the issue.
The error 0x2 result means that the file could not be found. Thus, make sure that when the Task starts, the batch file exists and is accessible. Also, it means "Access denied"; thus, you must check if you were facing a permission issue.
We can fix this issue in two possible ways:
1) Fix the issue with the help of a repair tool kit:
- Download the repair tool kit from the browser.
- Follow the prompts and install the program. On the welcome screen, you should untick the automatic scan option.
- Now, Click on install.
- After the installation process, the software will automatically scan your PC and show the damaged areas in your PC which have to be fixed.
- Click on the Repair button to fix the task scheduler error.
- Restart your PC.
2) Override the properties with the least privileges:
You can also try to configure the Scheduled Task to Run with the highest privileges in the Properties dialog of the Task.
- Double click on the particular Task, and go to properties.
- Kindly change it to Run with the highest privileges and click on OK.
- Enter the password.
- Thus, it allows the tasks to run without any error code.
If the problem persists, then try below to fix it,
You will have to disable logging in your robocopy script as it may create problems whenever the scheduler runs a task.
You must ensure that the file path you have given is correct because an incorrect file path can cause a 0x2 error. Also, check the permission as it can also be a reason for the error.
I hope the above fixes work for you, but if the problem persists, then we'll investigate further to overcome the error.
----------------------
Regards,
Austin_M
- LainRobertsonJun 03, 2022Silver Contributor
Access denied is 0x5, not 0x2. You can validate that for yourself using the following method.
You also do not need administrative rights to run scheduled tasks that run within cmd.exe.
Quick demonstration below.
blah.bat
@echo off echo Hello from cmd.exe pause
Scheduled task definition, created as an unprivileged user
Running the scheduled task as the unprivileged user
Cheers,
Lain