Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: Access is denied error in RegisterTaskDefinition method...

$
0
0

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


Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>