PowerShell – How to start a SharePoint Workflow

Ever needed to start a workflow for multiple List Items, or a selection of items.

This Example runs a WF on Customer Items in a list.

Well here we go :


if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
    Add-PSSnapin Microsoft.SharePoint.PowerShell;

start-spassignment -global
#Open the web site, list and the workflow

$site=get-spsite "www.SharePoint.com"
$web=get-spweb "www.SharePoint.com/YourSide"

#Open the library or list and workflow association
$affected = $web.getlist("http://www.SharePoint.com/Lists/Yourlist")
# WF Name
$wfname="Your Workflow" 



#Start workflow
#File with all ID's where the WF should be started for.

$Customers = Get-Content "D:\Temp\_Customers.txt" 

Foreach ($ID in $Customers){

    foreach ($item in $affected.items) {

     If ($item["ID"] -eq $ID){
      Write-Host $item["ID"] 

stop-spassignment -global 

I hope it worked as well for you.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: