Get all lists in Site collection and child sites(one level)

Below listed is a PowerShell to retrieve all the lists in Root site collection and its child sites(at one level)

Add-PSSnapin Microsoft.Sharepoint.Powershell
$site = Get-SPSite “SiteURL”
$sitelists = foreach ($web in $site.AllWebs) {
foreach($list in $web.lists){ $list }}
$sitelists |select Title | Export-CSV C:\liststitles.csv
Remove-PsSnapin Microsoft.SharePoint.PowerShell

Advertisements