How to terminate SharePoint 2013 Designer Workflow on PowerShell

Problem Description:

SharePoint Designer Workflows in version 2013 couldn’t be terminated on the GUI because they were in an undefined state​

Resolution:

​$web=get-spweb https://URL
$list=$web.lists[“ListName”]
$wfm=New-Object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($list.ParenWeb)
$wfm.GetWorkflowInstanceService()
$wfs=$wfi.EnumerateInstancesForListItem($list.ID,”$itemID”)
$wfi.TerminateWorkflow($wfs[0])

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...