How can the results of an Ivanti Automation job be extracted automatically with a task?
Job results can be exported in xml format by using the command line which is displayed in the Ivanti Automation Console > Jobs > Job History > [Right-click a scheduled job] > Export Job Results...
To export this using an 'Command (Execute) task', the MasterJobGUID needs to be adjusted for each job. This can be achieved by using the function @[MASTERJOBGUID]. This function will retrieve the MasterJobGUID of the current job.
Check the option 'Replace GUID with function' to create a general command line which can be used in a task to automatically export the job results to a desired location.
By using the task 'Execute Windows Powershell script' with the following script, only the details of the job results can be extracted and placed in a parameter with the option 'Set parameter with standard output'. This parameter can then be used in subsequent tasks. E.g. to distribute the results by sending am e-mail.
$Path = "<Path to the job results .xml file>" $XPath = "//stdout" $Node = Select-Xml -Path $Path -XPath $Xpath | Select-Object -ExpandProperty Node $Node.InnerText
Note: Some more information can be found in the following KB Article: HOWTO: Email the results of Recurring Jobs
Tip: By using a Run Book, one job can be used to perform the actions, e.g. create an Active Directory user. Another job in the Run Book can generate the Job Results xml file and the Windows PowerShell task to extract the details of the job. In this situation, only 1 Run Book is needed to perform the actions and extract and send the job details.