How to bulk cancel site workflows with a status of "Error Occurred"

  • 21 October 2014
  • 3 replies
  • 299 views

Userlevel 7
Badge +10

Products: Nintex Workflow 2013, Nintex Workflow 2010

 

A common request we see is "How do I cancel/terminate a group of site workflows that are in a state of 'Error Occurred'?" This article provides instructions on how to accomplish this.

 

Run the below (attached as well as a *.txt file for your convenience) PowerShell script (PowerShell ISE works well) from a SharePoint Server:

 

PowerShell Script

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)
    }

}

$(Get-SPWeb http://contoso.com).Workflows | where {[String]$_.StatusText -match [String]"Error"} | Cancel-SPWorkflow

 

 

To use the script, replace http://contoso.com with the URL of the site you wish to execute the script against.

 

For the List Item Workflow version of this article go here: How to bulk cancel list item workflows with a status of "Error Occurred"


3 replies

Aaron,

Finally I found that doing it without a filter works!

I'm not sure what the right filter string is for an errored workflow on a German SharePoint 2010 server. It's not "Error" or "Fehler" or "Errored". Do you have an idea how to find out?

Are there more convenient methods for bulk stopping Website Workflows in SharePoint Online / SharePoint 2016?

Best Regards,

Ronald

Badge +5

Maybe a little bit outdated but perhaps it still helps somebody else: you can also combine the filter to "Failed" (for workflows that errored on start which contains "Failed on start" in $_.StatusText).

Extend the filter-line to this:

... | where {([String]$_.StatusText -match [String]"Error" -or [String]$_.StatusText -match [String]"Failed")} | Cancel-SPWorkflow

Please help !!!

 

There are 195 nintex lists "Error Occoured" workflow which I need to end then restart.

I need a PowerShell scripts which can cancel/end a list nintex workflow "Error Occured" then it will restart the same list workflow automacially.

I have 195 list to work on....

I will appreciate any response,

 

 

 

 

 

Reply