问题
I need to create and modify tasks in Windows Task Scheduler on Windows Server 2003 from an ASP.NET web application. The Network Service that the web app runs under is unable to make the changes. It errors with an System.UnauthorizedAccessException exception.
It works fine running from Visual Studio on my desktop.
What permissions do I need to grant an account so that the tasks can be modified from ASP.NET?
回答1:
The account needs to have read/write permissions to the "Tasks" directory. Here's the path:
%SystemRoot%\system32\Tasks\
回答2:
Jose's answer solved my problem partially. However, there was an additional problem where Windows Server 2003 didn't like me specifying Local System as the account that the task would run under. It seemed to not like me passing in a null password which is how you specify Local System. I worked around the problem by making a local account on the server for tasks to run under and specifying this new account.
Specifying Local System didn't cause any problem on Windows XP.
Additional info
回答3:
CACLS TASKS /E /G builtin\administrators:F
According to: https://social.technet.microsoft.com/Forums/lync/en-US/67734412-bb17-42d5-80ff-0edf3147c169/cannot-create-scheduled-task-access-denied
来源:https://stackoverflow.com/questions/784311/permissions-required-to-create-modify-tasks-in-windows-task-scheduler