Starting a Workflow using Powershell

To start a workflow on a single list item , we can use the following PowerShell commands.

$web = Get-SPWeb -Identity
https://mysite/workflow 
$manager = $web.Site.WorkFlowManager  
 $mylist = $web.Lists["Shared Documents"] 
 $association = $mylist .WorkflowAssociations.GetAssociationByName("On Item Created","en-US") 
 $data = $association .AssociationData
$items = $mylist .Items foreach($item in $items) 
 {  $wf = $manager.StartWorkFlow($item,$association ,$data,$true)
  }   
$manager.Dispose()
$web.Dispose()
Ebook Download
View all
Learn
View all