List all Sharepoint Document Libraries

I'm looking for something I can run at the command line to list all document libraries within my site collection.  Is there a way to do this?  I did a browse of the STSADM.exe commands and there doesn't seem to be a way to list the document libraries.

Thanks,
Jamie
jamorlandoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

quihongCommented:
You'll probably need to write a custom Powershell script to do this.

Iterate through all your portals, then all your site collections and all sub sites. For each list, check the list type, if its a DocLib, output the result.

Here's a link to get you started - http://www.u2u.info/Blogs/karine/Lists/Posts/Post.aspx?ID=9

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jamorlandoAuthor Commented:
Thanks for getting me started.  Here's the code I wrote that produces the succesful output!


[void] [System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”)
$siteurl = "http://sharepoint"
$mysite=new-object Microsoft.SharePoint.SPSite($siteurl) 
$mysite.AllWebs | foreach { $_.Lists | where {$_.BaseTemplate -eq "DocumentLibrary"} | format-table $_.Url, Title} | Out-File -FilePath D:\output.txt

Open in new window

jamorlandoAuthor Commented:
Here's another version of the code using a * as a delimiter for parsing purposes.

[void] [System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”)
$siteurl = "http://sharepoint"
$mysite=new-object Microsoft.SharePoint.SPSite($siteurl)

foreach ($CurrentSite in $mysite.Allwebs)
{
   foreach ($CurrentList in $CurrentSite.Lists)
   {
      Write-Host $CurrentSite.Url * $CurrentList.Title
   }
}
jamorlandoAuthor Commented:
Sorry left my Document Library clause out of the nest loops. Here's what the loop should look like:

foreach ($CurrentSite in $mysite.Allwebs)
{
   foreach ($CurrentList in $CurrentSite.Lists)
   {
      if ($CurrentList.BaseTemplate -eq "DocumentLibrary")
      {
         Write-Host $CurrentSite.Url * $CurrentList.Title
      }
   }
}
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.