Analyzing running workflows on a SCOM Agent (HealthService)

Today I was asked: How do I get a usable list of all workflows running on a SCOM Agent? That’s easy, I thought: that’s why we have the built-in task “Show Running Rules and Monitors for this Health Service” for:


 

Unfortunately, the output is not really easy to understand and to process. Therefore I created a small function Get-SCOMHealthServiceWorkflowInformation which uses the same task, but provides a better output:

  1. It saves the task output as clean XML, which allows further processing
  2. It enriches the workflow information found on the HealthService with these information:
    - Type of workflow: Rule, Monitor, Discovery
    - Internal name and Display name of workflow
    - Internal name and Display name of target Object and Objectclass
    - Internal name, Display name and version of Management Pack where the workflow originates from
  3. It stores the custom workflow objects in a CSV file for later analysis.


Usage

The function has a built-in command based help, but here comes one usage example:

Function call
PS C:\> Get-SCOMHealthServiceWorkflowInformation -HealthServiceName scom2012-dc.scom2012.local -ExportTaskOutputXML -SaveWorkflowObjectsAsCSV –Verbose

Function output

 
The function can create two output files:


 
The XML contains the original task output:


 
And the CSV contains the custom, enriched workflow objects, which can be analyzed with Excel Pivot tables:

It allows you to answer e.g. these questions:

  • How many workflows of which type are running on the Agent?
  • How many objects (Class instances) are discovered on the Agent?
  • Which MP has running Workflows on this Agent?

You can download the function at TechNet Gallery here.