I am getting Access is denied error when try to run the example code in front page which is
using (TaskService ts = new TaskService()) { TaskDefinition td = ts.NewTask(); td.RegistrationInfo.Description = "Does something"; td.Triggers.Add(new DailyTrigger { DaysInterval = 2 }); td.Actions.Add(new ExecAction("notepad.exe", "c:\\test.log", null)); TaskPrincipal tp = td.Principal; ts.RootFolder.RegisterTaskDefinition(@"Test", td); ts.RootFolder.DeleteTask("Test"); }
I have running this code with Administration privileges and also I have manually created Test folder in Task Scheduler in Windows. My operation system is Windows 7 with UAC disabled.
So any idea, what I am missing? I had just search other discussions tried all other things but no solution..