Ah, I think I see. You are looking at impersonating the current user and then scheduling tasks. Others have tried this with mixed results. According to the Microsoft documentation, Task Scheduler should run using the current security token if the TaskService is instantiated with no user credentials. However, in practice, this doesn't always work. From the library's standpoint, if you are able to instantiate TaskService in the context of the current user, you then will call RegisterTaskDefinition without user credentials as well in order to register the task in their security context.
↧