We are using SP2010. I have prepared a PowerShell script to trigger particular workflow on particular object. Here is the script:
$web = Get-SPWeb "http://url/";
$list = $web.Lists["My list"];
$manager=$web.Site.WorkFlowManager
$association = $list.WorkFlowAssociations |Where { $_.Name -eq "Name of Workflow"}
$data = $association.AssociationData
$data=$association.AssociationData
$item = $list.GetItemById(1234)
$wf=$manager.StartWorkFlow($item,$association,$data,$true)
We have a dev and test sharepoint environment. Our dev environment is a single server installation. The script above can start the workflow but immediately turn to "Failed on start" error (and stopped). By running same script on our test environment, it works perfect.
I checked the ULS log, it indicate my web.config have problem.
RunWorkflow: Microsoft.SharePoint.SPException: An error occurred creating the configuration section handler for System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes: Could not find file 'C:\Users\devserver1\AppData\Local\Temp\ottgdnfv.dll'. (C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config line 683)
I have compared the web.config file between two environment and they are the same.
The same workflow can be triggered manually (on both environment) without problem.