This project has moved. For the latest updates, please go here.

Enumerate Commands

Feb 22, 2010 at 2:09 PM

I hate to ask a simple question but is there anyway to just enumerate the commands the Scheduled tasks are running? Such as the value set on the "Run:" property of the tasks.

 

Coordinator
Feb 23, 2010 at 1:57 PM

The commands are referred to as Actions and they are available as a property of a TaskDefinition.

using (TaskService ts = new TaskService())
{
   // Output all the actions for a specified task
   Task t = ts.GetTask("TaskName");
   if (t != null)
   {
      for (int i = 0; i < t.Definition.Actions.Count; i++)
         Console.WriteLine("  {0}: {1}", i, t.Definition.Actions[i]);
   }
}