SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out how to use powershell to start a list workflow. I found a few sites that give examples for sharepoint 2010 workflows, but only one for sharepoint 2013 workflows here.

Add-PSSnapin microsoft.sharepoint.powershell
$sourceWebURL = '<URL>'
$sourceListName = '<List Name>'
$TargetWorkflow = '<Workflow Name>'
$spSourceWeb = Get-SPWeb $sourceWebURL
$spSourceList = $spSourceWeb.Lists[$sourceListName]

#Getting a Workflow manager object to work with.
$wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($spSourceweb)
#Getting the subscriptions
$sub = $wfm.GetWorkflowSubscriptionService()
#Getting the specific workflow within the list of subscriptions on the specific list. (SP2010 associated workflows basically)
$WF = $sub.EnumerateSubscriptionsByList($spSourcelist.ID) | Where-Object {$_.Name -eq "$TargetWorkflow"}
#Getting a Workflow instance in order to perform my commands.

Foreach($item in $spSourceList){
    #Creating the dictonary object I need to parse into StartWorkflow. This could be most other workflow commands.
    $object = New-Object 'system.collections.generic.dictionary[string,object]'
    $object.Add("WorkflowStart", "StartWorkflow");
    $wfis.StartWorkflowOnListItem($WF, $item.ID, $object)

When I enter in the correct values the follow error get's thrown.

Cannot convert argument "itemId", with value: "GUID", for "StartWorkflowOnListItem" to type "System.Int32": "Cannot convert the "GUID" value of type "System.Guid" to type 
At line:23 char:5
+     $wfis.StartWorkflowOnListItem($WF, $item.ID, $object)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument

Does anyone know what I need to do to fix this error?

share|improve this question
$web = Get-SPWeb -Identity "http://YourParameter.xx/sites/publishing/en"

$workFlowManager = $web.Site.WorkFlowManager

$list = $web.Lists["YourParameter"]

$workflowAssociations =

$associationData = $workflowAssociations.AssociationData

$items = $list.Items

foreach($item in $items) { $workflow =



It works in my SharePoint 2013 farm (starts workflow for all items).

share|improve this answer
When I run that code I get the following error Exception calling "StartWorkflow" with "4" argument(s): "Value cannot be null." At line:15 char:28 + foreach($item in $items) { $workflow = $workFlowManager.StartWorkFlow($item,$wor ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ArgumentNullException Do you know how I can resolve the error? – zingwing Aug 11 '14 at 17:02
I got it working with 2010 workflows, just not 2013 workflows – zingwing Aug 11 '14 at 19:59
Could post the your function please? It seems you are missing one parameter for the method StartWorkflow(...). Could you double check if the parameters $item, $workflowAssociations and $associationData are not null? – Laslo Birnstil Aug 12 '14 at 8:55


Foreach($item in $spSourceList)

That's all because of in an $item you got list but not an item :)


foreach ($item in $sourcelist.Items)

The method in second post wont work with 2013 workflows only 2010!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.