It is a fairly regular occurrence that I get asked to export a selection of work items from SCSM into a CSV, or something similar, so they can be reviewed.  What isn’t so regular is that I get asked to include the full Action Log with the export of the work items!

I did get this request recently however, as an auditor required it for a number of random incidents, and it was needed rather quickly, so I put together the PowerShell script below which I thought would be worth sharing…

 

 

At first, the request to export a work item with it’s action log doesn’t sound to complicated, but the action log isn’t part of the Incident object, it is a related item, therefore the relationship class between the work item and action log is required in order to return the relevant related object (ie. Action Log).

This script will create a single CSV with a row for each IR passed to the script with columns for the ID, Title, Description, and Action Log.  As I am returning the object for each incident, this could easily be extended to export any other required information from the work item too!  It could also be amended for work item types other than Incident as well.

The full script can be downloaded at, http://aquilaweb.net/wp-content/uploads/2015/09/ExtractComments.zip.

To use the script, simply run the PS1 file passing the IR ID’s as a comma-separated parameter… example:  ExtractComments.ps1 “IR12345,IR54321”

Happy exporting!!

David