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 - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

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