locked
Bulk retry of scheduled workflows RRS feed

  • Question

  • For some as yet unknown reason my SCSM instance has accumulated over a thousand workflow instances that are in a "scheduled" status.  I am able to manually retry them from the Administration>Workflows>Status view and they seem to complete fine, but the have been this way for some time and have no rerun themselves.  I have a powershell script* which enumerates all the "Scheduled" workflows:

    import-module -force "C:\Program Files\Microsoft System Center 2012 R2\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 "Scheduled") {
                write-host $st.status  " "  $st.TimeStarted  " "  $st.TimeFinished  " "  $st.RelatedObject -ForegroundColor red
            }
    
        }
     }

    Is the any powershell cmdlet that could be used to "Retry" each "Scheduled" workflow instance as the script enumerates it?

    * Obtained from Thomas Stromberg


    Tuesday, February 16, 2016 12:17 AM