Fix: 0x80070005: Access is denied when running scheduled task as a non-administrator


I was running a scheduled task on a Windows 2003 server that called a script that ran as a non-administrator on the server.  The service account that the script ran under had rights to all the appropriate directories on the server, but I still kept seeing the following error after the scheduled task failed to execute:

0x80070005: Access is denied

The solution is documented in KB867466

Grant the Cmd.exe program Read and Execute permissions for the user account that the batch job runs under. To do this, follow these steps:

  1. Click Start, and then click Windows Explorer.
  2. Locate and then right-click the Cmd.exe file. The Cmd.exe file is located in the %windir%\System32 folder.
  3. Click Properties.
  4. Click the Security tab.
  5. Click Add.
  6. In the Enter the object names to select box, type the user name that the batch job runs under, and then click OK two times.Note When you add the user, the user is automatically granted Read and Execute permissions.
  7. Click Yes when you are prompted to continue.
 
This issue occurs if all the following conditions are true:
  • You run the batch job on a Windows Server 2003-based member server.
  • The batch job runs as a non-interactive process.
  • The batch job is configured to run under the context of an account that is not a member of the Administrators group.
In Windows Server 2003, the Users group does not have Read and Execute permissions to the command processor (Cmd.exe). By default, the Cmd.exe program has the following permissions settings:
  • The Interactive implicit group and the Service implicit group have Read and Execute permissions.Note On a member server, the TelnetClients group also has Read and Execute permissions. On a domain controller, the Batch implicit group also has Read and Execute permissions.
  • The Administrators group and the System implicit group have Full Control permissions.

2 Responses to “Fix: 0x80070005: Access is denied when running scheduled task as a non-administrator”

  1. Peter Dotto Says:

    I have followed all the steps but when i click properties i don’t see the security tab, what should i do? i am using windows XP.

  2. skinnafrog Says:

    You should disable Simple File Sharing like so:
    In Windows Explorer, go to Tools > Folder Options.
    On the View tab, uncheck the Use Sharing Wizard (or Use Simple File Sharing) option – it’s about the last setting


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: