I'm am attempting to bypass reporting on tasks that are not active, the status changes occasionally.
I have been able to "Activate" as task using svr.Jobs.Tasks.Activate(tID), however I only want to report on the status, not change it as with: JobObject.Stats.Active, is there a JobObject.Tasks.Stats.Active that I'm just not finding?
Line 28 is where I would like to check the status, if active or not, if not then bypass the print.
svr = clnt.Connect(conn, true);
List<JobClass> jobs = svr.Jobs.GetAll();
or (int i = 0; i < jobs.Count; i++)
{
JobClass job = jobs[i];
if (job.Stats.DateNextExecution.ToString() != "1/1/0001 6:00:00 AM")
{
String triggerDesc = "";
if (job.HasActiveTimeTriggers())
{
foreach (var trigger in job.Triggers)
{
if (trigger.Active)
triggerDesc += trigger.Description + ", ";
Console.WriteLine(trigger.Description);
}
}
if (job.Id == "bebe80d0-0a46-4d63-9746-c416c2d269b6")
{
Hydra = svr.Jobs.Get("bebe80d0-0a46-4d63-9746-c416c2d269b6", false, false);
List<TaskClass> Tasks = Hydra.Tasks;
for (int j = 0; j < Tasks.Count; j++)
{
TaskClass task = Tasks[j];
var testclass = Tasks[j];
String tID = task.Id;
Boolean isActive = svr.Jobs.Tasks.Activate(tID);
String HtaskName = task.Name;
Console.WriteLine("Task Name: " + HtaskName);
if (isActive)
{
sw.WriteLine("<tr>");
sw.WriteLine("<td></td>");
sw.WriteLine(" <td>Hail HYDRA!</td>");
sw.WriteLine(" <td> " + task.TaskType.ToString() + ": " + HtaskName + "</td>");
sw.WriteLine("</tr>");
}
}
}
}
}