ITMS Administrator Group

Expand all | Collapse all

Report the actual exit code in Task

  • 1.  Report the actual exit code in Task

    Posted 09-03-2018 04:55 AM

    Hello community,

    Maybe you can help. I need to report the actual exit codes from the running tasks. While the report in Reports\Task Server\Status\Job/Task Status Detail is ok, it reports only the status. I have to have the actual exit codes. For example, when you run Windows 10 compatibility scan, it exits with -1047526896 code.
    It translates into (0xC1900210) in hex, that stands for "it does not find any compat issue". According to there are few more codes that need to have a track of:

    • If it finds Actionable compat issues, like Apps, it will return MOSETUP_E_COMPAT_INSTALLREQ_BLOCK (0xC1900208)
    • If it finds that the Mig-Choice selected is not available, it will return MOSETUP_E_COMPAT_MIGCHOICE_BLOCK (0xC1900204)
    • If it finds that machine is not eligible for Windows 10, it will return MOSETUP_E_COMPAT_SYSREQ_BLOCK (0xC1900200)
    • If it finds that machine does not have enough free space to install, it will return MOSETUP_E_INSTALLDISKSPACE_BLOCK (0xC190020E)

    I have a custom sql code, that returns output of the task, but not the exit code.

    Any ideas ?



  • 2.  RE: Report the actual exit code in Task

    Posted 09-03-2018 05:11 AM


    I have amended the existing report and I managed to throw 2 birds with one stone. For reference I paste the report for script task execution. It reports both the output as well as the exit code.

    vc.[OS Name],
    i.Name as 'Task Name',
    replace(replace(replace(replace(cast(to2.Value as NVarchar(max)), '/',''), 'string', ''), 'int', ''),'<>','') as [Output],
    ti.Name as 'Task Instance Name'
    from TaskInstanceSummaries ti
    left join TaskInstanceParents tip on tip.ParentTaskInstanceGuid = ti.TaskInstanceGuid
    left join TaskOutputPropertyValue to2  on to2.TaskInstanceGuid = tip.TaskInstanceGuid
    join ItemVersions iv  on iv.VersionGuid = ti.TaskVersionGuid -- Find the name of the task
    join Item i  on i.Guid = iv.ItemGuid  
    join Evt_Task_Instances eti on eti.TaskInstanceguid = tip.TaskInstanceGuid
    join vComputer vc on vc.guid = eti._ResourceGuid
    where i.Name = 'Windows 10 Setup with Compatibility Scan'
    and to2.Name = 'scriptoutput'
    order by ti.StartTime desc 

    I hope it helps others having the same dilema.