title: 0x80070005 (E_ACCESSDENIED) In an ASP.NET application while trying to use Windows Task Scheduler
body: <p>I am currently working on an ASP.NET application in VB.NET and one of its functions is to use the Windows Task Scheduler. The application will need pretty much full control over this as it needs to Create, Modify, Delete and Run tasks.</p>
  
  <p>I found <a href="http://www.codeproject.com/KB/cs/tsnewlib.aspx?msg=247057" rel="nofollow noreferrer">this library</a> to help with the whole thing and it works well but only locally on my Windows XP machine. As soon as I deploy the application to IIS6 on Windows Server 2003 and access pages that use my Scheduler object I get the following error.</p>
  
  <blockquote>
    <p>Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))</p>
  </blockquote>
  
  <p>I have looked for various solutions on the net that include giving specific users (and even Everyone) permissions to %windir%\Tasks using CACLS which didn't work and also using impersonation and adding the IUSER to the Backup Operations User Group which won't work as the Application MUST use Windows Integrated Authentication.</p>
  
  <p>One thing that is confusing me about the whole situation is that the User I am logged in as when testing the application can quite happily remote desktop and login to the server and muck about with the Task Scheduler. Also, if I run the application locally in Visual Studio (still under the same User) and point the application at the Task Scheduler of the server it works fine. Further to this, If I run the application from the server and point it at my local Task Scheduler I get the same "Access Denied" error. All of that makes me think it is not a Task Scheduler permissions thingy but something to do with permissions on some components that the Task Scheduler Library is trying to use.</p>
  
  <p>Does any one know what I could do to resolve this or even just a pointer in the right direction as this has been driving me crazy for over a day now. I must say I am a bit of a newbie when it comes to IIS Issues, Impersonation and Windows Server Security.</p>
  
  <p>Thank you very much</p>