HowTo: Terminate all SharePoint 2013 workflows

Here's the code:

$credentials = get-credentials


$uri = new-object
uri("http://servername:12291/SharePoint/default/612588d5-8c9c-4e66-b962-cf1db4ae2906/20c099b0-4972-48ab-a547-2cf63ebe3ff2")


#note:  I'm not sure if these GUIDs are the same for eery workflow
farm or not.  YOu can find this in the WFResourceManagementDB.Scopes
table on your SQL Server.  You will need the full path.


$dcli = new-object Microsoft.Workflow.client.WorkflowManagementClient($uri, $credentials);


$im = $dcli.instances


$im.get() #this will show you all instances of workflows that have executed on your farm (even the ones that are still waiting)


foreach($inst in $im.get())


{


$im.Terminate($inst.WorkflowName, $inst.InstanceName, "Because I said so");


}