How to cancel all workflows having Suspended state in SharePoint 2013?

SharePoint deveopment training course

In this post, we will discuss how to cancel all workflows having status not equal to “Completed”. Suppose you have a list which contains more than 1000 items and you realize the workflow which is attached to the list going to Suspended state or in progress state. Here if you want to cancel the workflows which are not completed, then it can not be a manual task when your list is larger. If you have 10/20 items then you can do manually, but in another case the manual process is not a good option.

Also, check out:
Move document from one SharePoint site to another SharePoint site location in SharePoint 2010

SharePoint 2013 Add item to list using JavaScript client object model

Display SharePoint Blogs posts from Blog site on a SharePoint Online 2013 Homepage

I got a very good PowerShell approach from Raymun Macaulay’s Dev Blog to cancel workflows. Thanks to the author for sharing this.

Below is the PowerShell script:
#Your Shaeproint Site URL
$web = Get-SPWeb “”;
$web.AllowUnsafeUpdates = $true;
#Your List Name
$list = $web.Lists[“YourListName”];
$count = 0
#Loop through all Items in List then loop through all Workflows on each List Items.
foreach ($listItem in $list.Items)
foreach ($workflow in $listItem.Workflows)
#Disregard Completed Workflows
if(($listItem.Workflows | where {$_.InternalState -ne “Completed”}) -ne $null)
#Cancel Workflows
write-output “Workflow cancelled for : ” $listItem.Title;

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site

View all posts by Bijay Kumar →