How to quickly identify large workflows in SharePoint

  • 17 October 2014
  • 4 replies
  • 98 views

Userlevel 7
Badge +10

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).


4 replies

Badge +6

Does this apply to Nintex for Sharepoint 2016 also?

Badge

I see a difference in the size of the Nintex workflow  between the .nwf exported from  SP 2013 site settings-> Nintex Workflow gallery  and the output of the powershell from the script given in this article. If the exported .nwf file is 586 kb but the corresponding output of powershell for that workflow entry  was 1.24 gb.. please clarify me on this  size difference

Badge +1

I saw the same issue as Deepti Kumar, above. For example, one exported workflow was 599 KB, but the PowerShell script showed the same workflow as 743kb. Which size is accurate? 

Userlevel 7
Badge +10

743kb is correct as this is the actual workflow size in SharePoint.

Reply