In some case we need to run workflow all items in List which is very panic work  via SharePoint GUI. We have to select list and run workflow manually for each item which is not effective if situation of more rows.

Here we have small piece of cake in PowerShell command to accomplish the task but note this will not start instantly but in maximum 5 minutes as it’s triggered through SharePoint Timer Service.

$web = Get-SPWebApplication "http://mywebapp..
# URL of the Site
$web = Get-SPWeb -Identity "http://rijsharepointsite"
$wfmanager = $web.Site.WorkFlowManager
# Name of the list
$list = $web.Lists["List Name"]
# Name of the Workflow
$assoc = $list.WorkflowAssociations.GetAssociationByName("On Item Created","en-US")
$data = $assoc.AssociationData
$items = $list.Items
foreach($item in $items)
 {
 $workflow = $wfmanager.StartWorkFlow($item,$assoc,$data,$true)
 }
$manager.Dispose()
$web.Dispose()

 

References:

Leave a Reply

Your email address will not be published. Required fields are marked *