kwizcom banner advertisement

Find All Large Lists Exceeding Threshold Limit in SharePoint using PowerShell

Requirement: Find all lists exceeding the list view threshold limit configured on Web Application's resource throttling settings.
powershell to find large lists exceeding threshold limit in sharepoint

PowerShell Script to find all Large Lists which are exceeding the configured threshold limit:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get All Web Applications
$WebAppsCollection = Get-SPWebApplication

#Array to Hold Result - PSObjects
$LargeListsResult = @()

foreach($WebApp in $WebAppsCollection)
{
    #Get the Throttling Limit of the Web App
    $Threshold = $WebApp.MaxItemsPerThrottledOperation

    foreach($Site in $WebApp.Sites)
    {
        foreach($Web in $Site.AllWebs)
        {
            Write-host "Scanning site:"$Web.URL
            
            foreach($List in $Web.Lists)
            {
                if($list.ItemCount -gt $Threshold)
                {
                    $Result = New-Object PSObject
                    $Result | Add-Member NoteProperty Title($list.Title)
                    $Result | Add-Member NoteProperty URL($web.URL)
                    $Result | Add-Member NoteProperty Count($list.ItemCount)
                    
                    #Add the object with property to an Array
                    $LargeListsResult += $Result
                }
            }
        }
    }
}
Write-host "Total Number of Large Lists Found:"$LargeListsResult.Count -f Green

#Export the result Array to CSV file
$LargeListsResult | Export-CSV "c:\LargeListData.csv" -NoTypeInformation        

This script generates a CSV file at "C:\LargeListData.CSV", Just open it in Microsoft Excel, apply some formatting and here is how the report looks like:
get large lists report in sharepoint using powershell
Find All Large Lists Exceeding Threshold Limit in SharePoint using PowerShell Find All Large Lists Exceeding Threshold Limit in SharePoint using PowerShell Reviewed by Salaudeen Rajack on March 09, 2015 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.