• Display all Lists in a SharePoint site using PowerShell

    by  • May 9, 2010 • MOSS 2007, PowerShell, SharePoint 2010 • 0 Comments

    In this tutorial we will see how we can list out all the Lists in a SharePoint site using Windows PowerShell.

    Open Powershell and Enter the following cmdlets one by one.

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $spsite = New-Object Microsoft.SharePoint.SPSite("http://shoban")
    $spsite.AllWebs | foreach { $_.Lists | ft $_.URL, Title }
    

    In the first line we load the Microsoft.SharePoint assembly. In the second line we create a new SPSite object for our SharePoint site. In this case the url of the site is http://shoban

    In the last line we List out all the Lists in the site. We also use the ft cmdlet to Format the Output.

    If you want to write the output to a text file simply replace the last line with the following

    $spsite.AllWebs | foreach { $_.Lists | ft $_.URL, Title } > Lists.txt
    

    To open the new Text file created use the Invoke-Item cmdlet.

     

    About

    Shoban Kumar is currently working in an MNC in Trivandrum as a System Analyst. He actively writes .net articles in his blog http://www.codegeeks.net and http://www.dotnetcurry.com. He has also written many open source applications which can be found in Codeplex : http://www.codeplex.com/site/users/view/shobankr You can also follow him in Twitter @shobankr

    Leave a Reply

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