Tuesday, 22 September 2015

Task Scheduler Error Codes

Run result error code list.

Common Exit codes :

0x0 - ok
0x1 - incorrect function
0x2 - access denied
0x41301 - task is currently running

Other codes :

0x41300 - The task is ready to run at its next scheduled time.
0x41302 - The task will not run at the scheduled times because it has been disabled.
0x41303 - The task has not yet run.
0x41304 - There are no more runs scheduled for this task.
0x41305 - One or more of the properties that are needed to run this task on a schedule have not been set.
0x41306: Task is terminated.
0x8004130F: Credentials became corrupted (*)
0x8004131F: An instance of this task is already running.
0x800704DD: The service is not available (is 'Run only when an user is logged on' checked?)
0xC000013A: The application terminated as a result of a CTRL+C.
0xC06D007E: Unknown software exception.

Common fixes



0x2 - access denied

Problem
You are using Task Scheduler in Windows Server 2008 R2, Windows Server 2012, Windows Vista, Windows 7, or later to execute a .bat or .cmd file that contains statements that require administrator privileges. For example, you may be attempting to stop and/or start a Windows service with net.exe. In Task Scheduler, you have assigned an account that has administrative rights to the task. You have selected "Run whether user is logged on or not" and have entered and stored the password. You have confirmed that you can execute the .bat or .cmd file in a command window. When you attempt to execute the file via Task Scheduler, however, it does not work. While Task Scheduler does fire the task, it fails with a "Last Run Result" of "(0x2)", which means "access denied".

Cause
The Task Scheduler in Windows Server 2008 R2 and later and Windows Vista and later executes tasks under a "least privileges" security context by default.

Solution
Open the properties of the task and check Run with highest privileges. Press OK, then enter the password for the administrative account when prompted. This will override the default "least privileges" behavior and will allow the task to run with administrative privileges.

1 comment: