Quantcast
Channel: SharePoint 2010 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 13778

Stop All running workflows

$
0
0

Hi, 

Im trying to run a script to stop all running/suspended workflows on a list, Im using the scrip below but it doesnt seem to do anything. Can anyone see what i'm doing wrong?

#Site URL
$SiteUrl = “https://sharepoint.domain.net/ICT/TEST”
$web = Get-SPweb $SiteUrl
$web.AllowUnsafeUpdates = $true;    

#List Name
$list = $web.Lists["Workflow test"];

# Iterate through all Items in List and all Workflows on Items.         
foreach ($item in $list.Items) {
foreach ($wf in $item.Workflows) {

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


Viewing all articles
Browse latest Browse all 13778

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>