Search code examples
c#taskscheduler

Task Scheduler Managed Wrapper does not show all tasks


I have created a simple Windows Forms Application that displays the names and folders of all scheduled tasks on the machine. I'm using the Task Scheduler Managed Wrapper (Microsoft.Win32.TaskScheduler) and below is the code that gets the names and display them. However it seems as if AllTasks does not actually give me all tasks. There are some that are not displayed. What could cause a task to be hidden in this case?

using (TaskService tsksrvs = new TaskService())
{
    foreach (Task tsk in tsksrvs.AllTasks)
    {
        textJobsList.Text += tsk.Name + " (" + tsk.Folder + ")" + Environment.NewLine;
    }
}

Solution

  • As @nvoigt pointed out above the tasks not visible are running as a different user than the one executing the code.