How to: get a number of lists and lists items for SharePoint site collection

The fastest way to do it is to use following PS script:

Add-PSSnapin Microsoft.Sharepoint.Powershell

$ListsInfo = @{}

$TotalItems = 0

$SiteCollection = Get-SPSite ""

ForEach ($Site in $SiteCollection.AllWebs)


ForEach ($List in $Site.Lists)


$ListsInfo.Add($Site.Url + " - " + $List.Title, $List.ItemCount)

$TotalItems += $List.ItemCount



$ListsInfo.GetEnumerator() | sort name | Format-Table -Autosize

Write-Host "Total number of Lists: " $ListsInfo.Count

Write-Host "Total number of ListItems: " $TotalItems

It will count all the lists and number items inside of these lists, plus output total lists number and total items number in all lists for site collection URL of which you specify in 4th line of this script. This script works both for SharePoint 2010 and 2013.

If you are on look out for script to generate some list items for testing purposes you may find exactly what you need in Cameron Dwyer’s blog, in the following post “SharePoint PowerShell How To: Create SharePoint List Items (in Root and in Folders) for Load/Performance Testing.”

1 Comment

  • Diego Gomez says:

    Hi MikeYour script is good, I know if you have one script like this, but accounting Items in each site and in alls site?

Leave a Reply

Your email address will not be published. Required fields are marked *