Skip to content

Instantly share code, notes, and snippets.

@devendrasv
Last active December 24, 2015 17:29
Show Gist options
  • Save devendrasv/6836194 to your computer and use it in GitHub Desktop.
Save devendrasv/6836194 to your computer and use it in GitHub Desktop.
Get all document libraries in a site collection
#Load powershell snapin
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#Get site collection details
$s = Get-SPSite http://spjourney
#Get all web sites in the site collections
$wc = $s.AllWebs
foreach($w in $wc)
{
#loopthrouh the lists and libraries in the site
foreach($l in $w.Lists)
{
#Check for only document libraries
if($l.BaseTemplate -eq "DocumentLibrary")
{
Write-Host $l.Title"(Web: "$w.Title")"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment