aaron.labiosa@nintex.com

How to quickly identify large workflows in SharePoint

Blog Post created by aaron.labiosa@nintex.com Champion on Oct 17, 2014

Products: Nintex Workflow 2016, Nintex Workflow 2013, Nintex Workflow 2010

 

A common cause of workflow failure is size. Additionally, large workflows can cause widespread performance issues in your SharePoint farm. This article provides instructions on how to locate large workflows.

 

Run the below (attached as well as a *.txt file for your convenience) PowerShell script (PowerShell ISE works well) from a SharePoint Server:

 

PowerShell Script

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

 

#Workflows that are larger (in Kb) than threshold will be returned.
[int]$threshold = 500

 

function Get-WorkflowFolders {
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPWeb] $SPWeb
)

BEGIN {
  }

END {
}

PROCESS {
  $SPWeb.GetFolder("Workflows").SubFolders
  $SPList = $null
  [GC]::Collect()
}
}

 

function Get-WorkflowData{

PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPFolder] $SPFolder
)

BEGIN {
  }

END {
}

PROCESS {
        $obj = New-Object -TypeName PSObject -Property @{

        WorkflowSize = [Int]0
        ParentWebUrl = $SPFolder.ParentWeb.Url
        FolderUrl = $SPFolder.Url
        Url = $SPFolder.ParentWeb.Url + "/" + $SPFolder.Url

        }

  $SPFolder.Files | ForEach-Object{$obj.WorkflowSize += [Int]$_.Length}

        $obj

  $SPFolder = $null
        $obj = $null
  [GC]::Collect()
}

}

 

$(Get-SPWebApplication) | Get-SPSite -Limit ALL | Get-SPWeb -Limit ALL | Get-WorkflowFolders | Get-WorkflowData | where {$_.WorkflowSize -gt $($threshold * 1024)} | FT Url, WorkflowSize

 

The size of workflows returned can be adjusted by modifying the $threshold variable (default is 500 or 500kb).

Attachments

Outcomes