How to Get All Lists in SharePoint Site using PowerShell?

Get all lists in SharePoint site using PowerShell:

Managing lists and Libraries is an essential part of any SharePoint administrator’s job. What if you need to get a list of all the lists on a particular site? In this blog post, we will cover how to get all lists from a SharePoint site using PowerShell. This script can be modified to include additional filtering or operations depending on your needs.

To get all SharePoint lists by using PowerShell, use this script:

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

#Configuration Variables for Web URL
$WebURL ="https://sharepoint.company.com/"

#Get the site
$Web = Get-SPWeb $WebURL

#Get all sharepoint lists by using powershell 
$ListCollection = $Web.Lists

#sharepoint powershell loop through all lists
Foreach($list in $ListCollection)
{
   #get list details 
   Write-host $List.Title - $list.ItemCount - $List.Author.Name
}

One-Line Script to get all Lists in SharePoint using PowerShell:

(Get-SPweb "https://sharepoint.company.com/").Lists | ForEach-Object { Write-Host $_.Title}

SharePoint PowerShell to get all lists in a site collection:

Here is the PowerShell to get all lists in a site collection.

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

#Configuration Variables for Site Collection URL
$SiteURL ="https://sharepoint.company.com/sites/Sales"
$Site = Get-SPSite $SiteURL

#Iterate through each web in the site collection
foreach($Web in $Site.AllWebs)
{
    Write-Host $Web.Url -ForegroundColor DarkRed
 
    #Loop through each List in the site
    foreach($List in $Web.Lists)
    {
         Write-Host $list.Title -ForegroundColor Blue
    }
}

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

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