We installed Sharpeoint 2010 SP2 and then suddently all workflows stopped working, they are all in start mode.
According to this thread, it should be fixed with June CU, we installed it, but this didnt fix the issue: http://social.technet.microsoft.com/Forums/sharepoint/en-US/5a6e6e83-b59f-4099-a86f-a07723ff2b98/workflow-stuck-in-starting-state-after-applying-sharepoint-2010-cu-december-2012
Now, we want to try the script approach, but the script provided there seems it will start workflows in all items, I want to start workflow only when the status is starting.
The script I have is like this
#The purpose of this script is to start the SPD workflow with the windows task scheduler for a trigger
#This should avoid the check in-out issue caused by the December 2012 SP CU patch
#This needs to be run on an account with membership in the farm administration group for SharePoint and Shell in SQL
#You can use a find and replace to replace the server and other names with your actual names
#There are no status messages being used since this will be a scheduled task in the Windows task scheduler
#Add SharePoint modules and create variable space
add-pssnapin microsoft.sharepoint.powershell
start-spassignment -global
#Open the web site, list and the workflow
$site=get-spsite https://mysite.com
$web=get-spweb https://mysite.com/myweb/
#Open the %affected% library or list and workflow association
$affected=$web.getlist("Practical Tips")
$manager=$site.workflowmanager
$culture=[system.globalization.cultureinfo]::currentculture
$wfname="News approval workflow"
$association=$affected.workflowassociations.getassociationbyname($wfname,$culture)
$data=$association.associationdata
$wfrunoption=[microsoft.sharepoint.workflow.spworkflowrunoptions]::synchronous
#Start workflow
foreach ($item in $affected.items) {
$site.workflowmanager.startworkflow($item,$association,$data,$wfrunoption)
}
stop-spassignment -global