cancel
Showing results for 
Search instead for 
Did you mean: 

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

aaron_labiosa
Nintex Newbie
16 4 6,662

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"

4 Comments
ronald_dartsch
Nintex Newbie

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

Not applicable

Great article on how to accomplish this with PowerShell.  To do this with just Nintex, here's an article, we just published: terminate site workflows with Nintex.  Check it out.

lonesurvivor
Nintex Newbie

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

mohammad8901
Nintex Newbie

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,