How to quickly identify large lists in SharePoint

  • 11 October 2014
  • 1 reply
  • 406 views

Userlevel 7
Badge +10

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

 

A common cause of workflow failure is large lists, document libraries, task lists and workflow history lists. This article provides instructions on how to locating these large lists.

 

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

 

The lists returned can be filtered by setting the $threshold variable (default is 200). Additionally, the properties returned can be changed by appending properties to the end of the script (default is ParentWeb, Title, ItemCount).

 

# This will target all Nintex Workflow History lists, you can change the threshold to filter down.
# This is used to find where the lists are and if they are larger than the threshold.
# This will target the entire farm, you may want to scope it down to site collection.

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
#Lists with values higher than threshold will be returned
[int]$threshold = 200
function Get-SPListCollection {
PARAM
(
[Parameter(ValueFromPipeline=$true)] [Microsoft.SharePoint.SPWeb] $SPWeb
)
BEGIN {
  }
END {
}
PROCESS {
  $SPWeb.Lists
  $SPWeb = $null
  [GC]::Collect()
}
}
$(Get-SPWebApplication) | Get-SPSite -Limit ALL | Get-SPWeb -Limit ALL | Get-SPListCollection | WHERE {$_.BaseTemplate -eq "WorkflowHistory"} | where {$_.ItemCount -ge $threshold} | FL ParentWeb, Title, ItemCount
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

1 reply

Userlevel 7
Badge +10

If there is a need for this script on SharePoint 2007 drop some comments and I can add a separate script that will provide backwards compatibility.

Reply