Posted on:
Categories: PowerShell;SharePoint


SharePoint 2013 Workflow Manager is in a broken state. You must find all of the instances of SharePoint 2013 Workflows in order to gauge the impact of the problem.


Knowing that Workflow Manager is in a broken state, we won't be able to use its API to find all the workflows. From experience, I know that SharePoint 2010 Workflows are stored in the site in a library called "Workflows". At this point, I went to my DEV environment and created a 2013 workflow and started looking around for it. Luckily, the 2013 workflows work the same way and I didn’t have to open up to code to find them.

The following script will return all sites which contain a SharePoint 2013 Workflow. The results will be output in a csv format with | as the delimiter.

# Name:               Get-SP2013Workflows.ps1  
# Description:         This script will find SharePoint 2013 Workflows 
# Usage:            Run the function
# By:                 Ivan Josipovic,  
Function Get-SP2013Workflows(){
 foreach ($web in get-spsite -limit all | get-spweb -limit all ){
  if ($web.folders["wfsvc"] -ne $null) {
   foreach ($wfFolder in $web.folders["wfsvc"].subfolders | ? {$ -ne "forms"} ) {
    $xaml = $wfFolder.files | ? {$".xaml")};
    $xamlStream = new-object System.IO.StreamReader($($xaml.OpenBinaryStream()));
    $xml = [xml]$xamlStream.ReadToEnd();
    Write-Host "$($web.url)|$($xml.Activity.Class.ToString().TrimEnd(".MTW"))";