spacer
A Tip From Kinetic Computer Services ...

Access denied (0x2) error as an administrator in Windows Task Scheduler


Previous tip: Cannot Access Certain Web sites On Windows 8
Next tip: Cannot Use Ports 25 or 26 of HP 1910 Switch

Tips Main Page

Description of the 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.

David Carson
Posted on September 5, 2014
© Copyright Kinetic Computer Services

Previous tip: Cannot Access Certain Web sites On Windows 8
Next tip: Cannot Use Ports 25 or 26 of HP 1910 Switch

Tips Main Page

This tip is a free service of Kinetic Computer Services - professional network consultants serving the Houston area since 1998.

Reproduction of this document without the author's consent is prohibited.


spacer