Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Ever wondered, how many list items you have in a Web Application?
You can use this Windows PowerShell script to know the total number of list items in a SharePoint Web Application. You can tweak the recursion to get list item details for subsite o for site collection level...
Below is the sample script.
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{Add-PSSnapin Microsoft.SharePoint.Powershell}
$SPWebApp = Get-SPWebApplication("https://intranet.contoso.com")
$i=0
foreach ($SPSite in $SPWebApp.Sites)
{
Write-Host "Going thru Site Collection" $SPSite.Title
foreach ($SPWeb in $SPSite.AllWebs)
{
Write-Host "Going thru Web" $SPWeb.Title
foreach ($SPList in $SPWeb.Lists)
{
Write-Host "Going thru List" $SPList.Title "which has" $SPList.ItemCount "item(s)"
foreach ($SPListItem in $SPList.Items)
{
Write-Host "Going thru Item" $SPListItem.Name
$i=$i+1
}
}
$SPWeb.dispose()
}
$SPSite.dispose()
}
Write-Host "Total item count" $i
Comments
Anonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
realy nice! thxAnonymous
January 01, 2003
Great Job! :DAnonymous
January 01, 2003
Thank you very much! How I can I run this in MOOS 2007? I have PowerShell installed already but I get errorAnonymous
January 30, 2013
Nice blogAnonymous
September 28, 2013
The SPWeb was not defined in earlier statement. You mean $SPSite.Title ? Write-Host "Going thru Site Collection" $SPWeb.Title -thxAnonymous
November 17, 2013
@Venkat: Thanks, corrected!