Script Download:

This script enumerates through a "large" list or document library and provides information about items in it.

In SharePoint (2007 and 2010) we have a threshold on the number of list items in a container. In SharePoint 2007, the threshold value is 2,000 and in SharePoint 2010, it is 5,000. We often come across customers who have a large number of items in their lists/document libraries and complain of overall site performance. It is possible for customers to create nested folders and have a large number of documents/list items reside in them. But exceeding the threshold value can cause slowness and have a performance impact on the backend SQL content database.

For example, if you have 500,000 documents stored within folders (and nested folders) in a document library, it becomes difficult to identify specific folders that exceed the threshold value. This script traverses through each folder in a given list/document library and will enumerate items at each container level. It writes the output to a .CSV file to make it easier for viewing in Excel and perform further filtering.

This PowerShell script and makes use of the SharePoint Object Model. You will have to provide the name of the list or document library that you want to traverse. The
output is written to an out.CSV file that can be opened in Excel for further filtering of data. The details written include:

  • Parent Name: The container under which the items reside
  • Content Type: The content type of each item
  • No. of Versions (Minor and Major): The total number of versions that exist for the item
  • Size in Bytes (Current Version Only): Applicable only for items in a document library. This column has values to indicate the size of the current version of a document.
  • Breaks Permission Inheritance: Boolean value to indicate if the item breaks permission inheritance
  • Item Count (For Folders Only): The total number of items inside a container


image image

You can find more All-In-One Script Framework script samples at