Washington DC Endpoint Management User Group

 View Only
  • 1.  Task Instance Details - SDK Not very useful

    Posted Feb 15, 2013 10:34 AM

    I have a workflow that schedules our computer build jobs. I now want to add a PCT step in there. Since I have to wait for the PCT Capture and Image deployment jobs to finish before starting the PCT Deploy task, I need to figure out when a job is finished. Currently the Schedule Task API doesn't return the task instance once a task is scheduled. Which is a big PITA. So I have to hunt through the task tables to find the most current running task and match it to the job I scheduled. I think I found the correct tables for this though I can't quite figure out how to link the JOB to the TASK instance.

    However... the absolute ideal solution would be to be able to get all the data that is showed in the "Task Instance Details" screen in the console when you drill down to a computer to find out what step it's on. Does anyone know what tables this data is coming from?

    In the workflow I know the GUID of the Job, and the GUID of the Computer. What I need is the TaskInstance of the job, what step in the job the computer is currently doing, how many steps are left, and if those steps were successful or not for the subtasks and the overall Job.



  • 2.  RE: Task Instance Details - SDK Not very useful

    Posted Apr 10, 2013 04:43 AM

    Did you ever work this out, I started looking through the tables yesterday and have yet to find what I (we) are looking for.



  • 3.  RE: Task Instance Details - SDK Not very useful

    Posted Apr 10, 2013 04:10 PM

    Are you using 6.9 or 7.1? We're doing something similar with workflow and ds 6.9. I'm using the wait on external event component to check when the job is completed via a sql stored procedure then continue with the rest of the job. Once completed it notifies the user. 

     

    We've simply broken the jobs down into separate tasks then piece it together with workflow as follows..

     

    Select OS/Office Version > Change BIOS > Capture Ghost Hot Backup (adding for XP to 7 migration) > Capture Personality > Image Computer > Deploy Personality > (option to restore ghost image if something goes wrong) > Completed



  • 4.  RE: Task Instance Details - SDK Not very useful

    Posted Apr 11, 2013 03:50 AM

    I once build a report to check for run tasks, maybe the sql can help you find what you need, if you start the task by workflow you can give it specific run name. Maybe that way you can add some number sequence and find the right ones. Hope it pushes you in the right direction.

    select distinct
         vc.Name,
         it.Name as Task,
         eti.Result,
         eti.Success,
         eti.EndTime
            
    from Evt_Task_Instances eti

    join  ItemVersions iv
         on eti.TaskVersionGuid = iv.VersionGuid
    join vItem it
         on it.Guid = iv.ItemGuid
    join vComputer vc
         on vc.Guid = eti._ResourceGuid
    join dbo.CollectionMembership cm
         on vc.Guid = cm.ResourceGuid

    where
         eti.InstanceType = 'Client'
         and vc.name <> ''
         and eti.EndTime is not null
         and eti.EndTime > GETDATE()-2
         and it.Name like '%%TaskName%%'

    order by
         vc.Name,
         it.Name



  • 5.  RE: Task Instance Details - SDK Not very useful

    Posted Apr 11, 2013 06:14 AM

    Using 7.1

    I came up with 3 queries that will get different information. The below assumes you are starting the Altiris Job via Workflow as this gives you access to the Exposed Altiris Task Run Instance GUID.

     

    -- This gets the Job summary info

    SELECT TaskName, StartTime, EndTime, Result, InstanceStatus, Success, TaskInstanceGuid, ParentTaskInstanceGuid

    FROM Evt_Task_Instances

    WHERE TaskInstanceGuid = @ExposedAltirisTaskGuid

     

    -- This gets the Job instance summarie(s)

    SELECT it.Name, eti.StartTime, eti.EndTime, eti.Result, eti.InstanceStatus, eti.Success, TaskInstanceGuid, ParentTaskInstanceGuid

    FROM Evt_Task_Instances AS eti

    INNER JOIN ItemVersions AS iv ON eti.TaskVersionGuid = iv.VersionGuid

    INNER JOIN Item AS it ON iv.ItemGuid = it.Guid

    WHERE eti.ParentTaskInstanceGuid = @ExposedAltirisTaskGuid

    ORDER BY StartTime

     

    -- And finally, this gets the individual job steps and their results from the Job instance.

    SELECT it.Name, eti.StartTime, eti.EndTime, eti.Result, eti.InstanceStatus, eti.Success, TaskInstanceGuid, ParentTaskInstanceGuid

    FROM Evt_Task_Instances AS eti

    INNER JOIN ItemVersions AS iv ON eti.TaskVersionGuid = iv.VersionGuid

    INNER JOIN Item AS it ON iv.ItemGuid = it.Guid

    WHERE eti.ParentTaskInstanceGuid = (SELECT TaskInstanceGuid FROM Evt_Task_Instances WHERE ParentTaskInstanceGuid = @ExposedAltirisTaskGuid )

    If your workflow applies Altiris jobs to multiple resources at once, you'll have to add the resourceguid to the where clause (eti._ResourceGuid in my example)