Iterate through all of the documents in a SharePoint sub-sites in a site. It does both the site and all of the sub-sites
Add-PsSnapin Microsoft.SharePoint.PowerShell
Set-location $home
$SiteURL = "http://portal.opwftg.com/sites/OPWSS/Teams/Acq"
$allWebs = Get-SPWeb -Identity $SiteURL -Limit all
"ListTitle|ListURL|ItemTitle|ItemDisplayName|ItemURL|ItemContentType"
foreach ($spweb in $allWebs) {
foreach($list in $spweb.lists)
{
foreach($item in $list.items)
{
$list.Title + "|" + $sub.URL + "/" + $list.RootFolder.Url + "|" + $item.Title + "|" + $item.DisplayName + "|" + $spweb.URL + "/" + $item.Url + "|" + $item.ContentType.Name
}
}
foreach($sub in $spweb.Webs)
{
foreach($list in $sub.lists)
{
foreach($item in $list.items)
{
$list.Title + "|" + $sub.URL + "/" + $list.RootFolder.Url + "|" + $item.Title + "|" + $item.DisplayName + "|" + $sub.URL.URL + "/" + $item.Url + "|" + $item.ContentType.Name
}
}
}
$spweb.dispose()
}