This project has moved and is read-only. For the latest updates, please go here.

Access is denied error in RegisterTaskDefinition method...

Topics: Errors
Dec 26, 2012 at 2:22 PM

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);


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..

Jan 2, 2013 at 3:40 PM

Permissions at either the system level or checking if UAC is blocking your rights would be my first guess. Nothing else seems to be amiss.