SCOM: Retrieve Worflow Details


Many times in SCOM you will see Alerts concerning processes that failed to start. Such as “Operations Manager failed to start a process or script” and within the alert you get the workflow name i.e. “Microsoft.SQLServer.2008.ReportingServicesDiscoveryRule.Server”

Here’s a little powershell script that will give you more details upon this workflow. It will tell you wheter it concerns a discovery, monitor  or rule” and the class on which it is targeted. This info will help you in defining overrides for these alerts in the Authoring pane.

GetWorkflowDetails

#GetWorkflowDetails.ps1

param(
 [String] $Workflow
 )
$Discovery = Get-SCOMDiscovery -Name $Workflow
$Rule = Get-SCOMRule -Name $Workflow
$Monitor = Get-SCOMMonitor -Name $Workflow

If ($Discovery -ne $NULL)
{
$Class = get-scomclass -Id $Discovery.DiscoveryClassCollection.TypeId.Id
Write-host (“Discovery : {0} – Class: {1}” -f $Discovery.DisplayName,$Class.DisplayName)
}
Elseif ($Rule -ne $NULL)
{
write-host “R”
$Class = get-scomclass -Id $Rule.Target.Id
Write-host (“Rule : {0} – Class: {1}” -f $Rule.DisplayName,$Class.DisplayName)
}
Elseif ($Monitor -ne $NULL)
{
$Class = get-scomclass -Id $Monitor.Target.Id
Write-host (“Monitor : {0} – Class: {1}” -f $Monitor.DisplayName,$Class.DisplayName)
}
Else
{
Write-host “Workflow not found”
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s