7

i have a bat file im trying to schedule every morning.

whilst in the Scheduled Task Wizard... when i click on finish... i get a ...

The new task could not be created. The specific error is: 0x8007005: Access is denied. Try using the Task page Browse button to locate the application

I have attempted using both a domain account that is an administrator on the box... and a local account that is an administrator on the box.

On another machine ... i have managed to get this work.. but cannot figure out the difference in configuration. It is using the domain account to run the bat file.

mattdm
  • 6,600
  • 1
  • 26
  • 48
hiddenkirby
  • 225
  • 2
  • 4
  • 10

7 Answers7

8

There is a much simpler way if it has to do with permissions on the task directory. This directory is protected, so you must use a resource kit tool to make changes to its permissions.

First install subinacl (you have to get this from Microsoft)

Then run these three commands from a cmd prompt and root of your c: drive.

cd\
cacls c:\windows\tasks /T /E /P Administrators:F
cacls c:\windows\tasks /T /E /P SYSTEM:F

These commands will grant full permissions to the tasks folder for the user group Administrators and the user System.

Falcon Momot
  • 25,244
  • 15
  • 63
  • 92
  • 1
    Actually, this works perfectly well, without breaking anything - as opposite to @mpacesaints answer, which breaks IIS sites completely. – thomasb Sep 12 '12 at 13:02
  • This did not work for me on Windows 10. I also tried running the same commands against `C:\Windows\System32\Tasks` to no avail. – Jim Feb 03 '16 at 20:00
6

OK Guys, this issue plagued me for some time. I finally found a solution and would like to share.

Warning! The following solution involves the Windows System Registry. Editing or manipulating the registry incorrectly can result in serious system damage which may require reinstallation of the operating system. If you are not comfortable editing the registry, then take your system to a professional. If you choose to proceed, then it is essential that you create a complete system backup and a Windows System Restore Point before proceeding.

First download subinacl from Microsofts web site and run the installation package. http://www.microsoft.com/downloads/details.aspx?FamilyID=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&displaylang=en

SubInACL is a command-line tool that enables administrators to obtain security information about files, registry keys, and services, and transfer this information from user to user, from local or global group to group, and from domain to domain.

Next copy and paste the following command to a text file. Save the file as reset.cmd. Once saved double click the file and the commands will begin to run. This process takes anywhere from 3 to 10 minutes of time. After it has run, there will be no restart required in most cases(Oracle I found to be a different story). Proceed with scheduling task or whatever you were doing before getting the dreaded "Access Denied" Error. Hope this helps!

cd /d "%ProgramFiles%\Windows Resource Kits\Tools"
subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f
subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f
subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f
subinacl /subdirectories %SystemDrive% /grant=administrators=f /grant=system=f
subinacl /subdirectories %windir%\*.* /grant=administrators=f /grant=system=f
secedit /configure /cfg %windir%\repair\secsetup.inf /db secsetup.sdb /verbose
AKX
  • 843
  • 6
  • 7
  • this did the trick. i just ran the two files and the task scheduled without a problem. thanks a bunch. – hiddenkirby Jul 07 '09 at 15:16
  • Excellent answer, I ran into this issue a while ago and took about a week before I found the same fix you did, was quickly bookmarked and put in the our 'internal' wiki 'cause its fixed most of my oddball task scheduler issues. – drgncabe Jul 07 '09 at 15:39
  • This made the scheduled tasks work again, but it crashed completely the websites. I would try "user62697"'s answer (do the same only on c:\windows\tasks) before this one. – thomasb Sep 12 '12 at 09:56
  • I would *strongly* advise against messing with permissions in %WINDIR%, even if it only grants to administrators and system. If you suspect, your %WINDIR% permissions have been altered and broke something, see http://support.microsoft.com/kb/313222/en-us for to restore them to a known-working default state using `secedit` – the-wabbit Mar 26 '14 at 11:21
1

Resolved for me - Same issue in Windows Server 2008 Standard Edition SP2. Debugging the Scheduled Task provided the info "Error 5 Access is denied"

Resolved by checking "Run with highest privileges" on General tab of scheduled task properties

0

I think this solution sounds more reasonable :

http://support.microsoft.com/kb/867466/en-us

Grant Read/Execute rights on %windir%\system32\cmd.exe to BATCH user and make sure the user that will run the task as Log on as Batch job rights in the local secu policy.

0

I had a similar issue on a machine running XP Home Edition, it was not part of a domain though. In that instance the problem was that the account I was trying to schedule the task to run as did not have a password. For task scheduler to work, the account requires a password.

Ryan Fisher
  • 2,228
  • 16
  • 13
0

Make sure the Task Scheduler service is turned on.

Also, you may have Tasks disabled via Group Policy.

0

Are you attempting to schedule the task with the same account that created it? To troubleshoot, I'd just delete, recreate, & schedule. You didn't mention the OS, but ownership seems to be biting me more often with 2008/win7 lately.

Kara Marfia
  • 7,892
  • 5
  • 33
  • 57