There is a workflow (Visual Studio and SP 2010 style WF) that seems to be getting stuck every so often when it errors. I see the item in the WF history for the list item saying something like "An error occurred."

Is there a way that I can determine via PowerShell if a running WF has thrown an error? In this case if I look at the $listItem.Workflows[0].StatusValue it says "In Progress" - technically that is correct... But it's also not true because it's just sitting there doing nothing.

BTW, the actual issue that was causing this has been corrected. But if I can find a quick way to identify items that are stuck in this way, it might be of help in the future.

1 Answer 1


Does this issue seem similar to you? The suggested solutions could be tailored to your situation. I would have quoted some of the code but the OP never marked one as an answer.

Basically my suggestion to the other person was filter the workflows that had been running for more than 4 hours. Without having any real long running workflows that should have flagged the failed workflows.

My other suggestion was to try an SPSiteDataQuery. It would be a bit more efficient than looping through lots of webs. It uses CAML to query the whole site collection at once.

You just need to figure out what property to query. For that I would try $listItem.Workflows[0] | Get-Member. It will list the properties and methods on the workflow item and hopefully there is something that has the value you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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