Windows Scheduled Tasks – Fixing ‘Access Denied’ Error

scheduled-taskwindows

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.

Best Answer

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