Check for Failed Workflows

This handy PowerShell script will run against your workflows to check if there are any Failed and will advise you of which one.

You will need to change the import-module path to where Service Manager was installed.

import-module -force “D:\Microsoft System Center\Service Manager\PowerShell\System.Center.Service.Manager.psd1″

# Save all WF into $workflow
$workflow = Get-SCSMWorkflowStatus

# Loop $workflow
foreach ($wf in $workflow) {

$status = Get-SCSMWorkflowStatus -name $wf.Name
$status = $status.GetStatus()

write-host Workflow $wf.name -ForegroundColor Cyan
foreach ($st in $status) {
if ($st.status -eq “Failed”) {
write-host $st.status  ” ”  $st.TimeStarted  ” ”  $st.TimeFinished  ” ”  $st.RelatedObject -ForegroundColor red
}

}
}

2017-03-30_10-28-37

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