Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Does the domain account that you're executing the task with have permissions to read/execute the bat in question? –  Mark Henderson Jul 7 '09 at 0:02

7 Answers 7

up vote 5 down vote accepted

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
share|improve this answer
    
this did the trick. i just ran the two files and the task scheduled without a problem. thanks a bunch. –  hiddenkirby Jul 7 '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 7 '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. –  cosmo0 Sep 12 '12 at 9: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 support.microsoft.com/kb/313222/en-us for to restore them to a known-working default state using secedit –  the-wabbit Mar 26 at 11:21

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.

share|improve this answer
    
Actually, this works perfectly well, without breaking anything - as opposite to @mpacesaints answer, which breaks IIS sites completely. –  cosmo0 Sep 12 '12 at 13:02

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

share|improve this answer

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.

share|improve this answer

Make sure the Task Scheduler service is turned on.

Also, you may have Tasks disabled via Group Policy.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

protected by sysadmin1138 Aug 25 at 11:14

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.