Skip to main content
Search Again

We think these articles could help you:

    See More
    Nintex Knowledge Base

    Stuck Workflows Slowing Down SharePoint Environment

    Status: Validated

    ISSUE
    Several hundred workflows have become stuck on 'Failed on Start (retrying)' and are causing the entire SharePoint environment to slow down.
    ERROR CODE
    RESOLUTION
    1. Identify the lists where these workflows have become stuck.
    2. Using the script below, target the affected lists, and then use the script to terminate the stuck instances:
    NOTE: Users must update the list name in the last line from 'WorkflowTestingList' to the name of the affected list. This script will terminate *ALL* workflows on said list with the status of 'Failed on Start (retrying)'
    Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
    function Cancel-SPWorkflow(){
    PARAM 
    (
    [Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.Workflow.SPWorkflow] $SPWorkflow
    )
    
    BEGIN {  }
    
    END {}
    
    PROCESS {
            [Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($SPworkflow)
        }
    }
    function Get-SPWorkflow(){
    PARAM 
    (
    [Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPListItem] $SPListItem
    )
    
    BEGIN {
      }
    
    END {
    }
    
    PROCESS {
            $SPListItem.Workflows
        }
    }
    $(Get-SPWeb http://nsp-jb-sp13-1.nintexsupport.com/workflow).Lists["WorkflowTestingList"].Items | Get-SPWorkflow | where {[String]$_.StatusText -match [String]"Failed on Start (retrying)"} | Cancel-SPWorkflow

     
    ADDITIONAL INFORMATION
    RELATED LINKS
    • Was this article helpful?