How to Stop Workflow in SharePoint 2013 using PowerShell

Hello Fellow Readers,

If you are using sharepoint 2013 workflow and you would have encountered same situation like me. when I try to automate the workflow using sharepoint designer 2013, there have been many instances of workflow running parallely which made to stop all the worklfow manually and its really time consuming one.  In this blog, I m sharing few lines of Powershell commands that comes in hand to stop all the workflow associated with a SharePoint List.

# URL of the Site
$web = Get-SPWeb -Identity “https://mysite/sites”

#Get the Workflow Manager.
$workmanager = $web.Site.WorkFlowManager

# Name of the list
$list = $web.Lists[“Picture Library”]

$items = $list.Items

foreach($item in $items)
foreach ($wf in $item.Workflows) {

#Cancel Workflows
[Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($wf);
}
}
$web.Dispose();

Please visit my others blogs on the below topics as well

Clear your SharePoint Designer Cache 2010 & 2013

Get the Running Workflows in SharePoint 2013

Make your site Collection Read only in SharePoint 2013

Feel free to add any suggestions or improvements .Thank you for your precious time.

Leave a Reply

Your email address will not be published.