AnsweredAssumed Answered

Double Task on PowerShell start

Question asked by mvahsen on Aug 7, 2017
Latest reply on Aug 8, 2017 by mvahsen

When I start the Workflow with a PowerShell script, then I got 2 tasks with the same name to complete.

The first one says no task ID found , the second one works. But the desired behaviour is only one task should appear.


When the workflow is started manually then there is only one task. The task is a simple confirmation.


Here is the  PowerShell code to call the Workflow:


$web = Get-SPWeb $mySiteUrl
$list = $web.Lists[$sDocLibraryName]
$wfm = $web.Site.WorkFlowManager
$association = $list.WorkFlowAssociations |Where { $_.Name -eq $WFName}
$data = $association.AssociationData

$wc.Credentials = Import-Clixml $credentialsPath

$item = $list.GetItemById($listItemID);

$wf = $wfm.Startworkflow($item,$association, $data,$true)

Write-Host "Workflow started, please wait 10 seconds" -ForegroundColor Green;

Start-Sleep -Seconds 10