I am writing a powershell script to find out all the In-Progress workflow instances in a site collection. Usually, the suggested way to do this is to find associated workflows to a list and check the status of the association. This saves from having to iterate through all list items.
BUT! I was able to find cases where I was running OOTB workflows (Feedback) on some list items - and they were never detected by the script. My only guess is that not all workflow instances necessarily have workflow association with the list. Could anyone shed some light into this for me please?
My PS pseudo-script:
# For each site in site collection
# Get all Lists
# For each list
if (list.WorkflowAssociations.Count != 0)
foreach (SPWorkflowAssociation workflowAssociation in list.WorkflowAssociations)
{
# Get active workflows
...
}