Here is the script I am running:
#get input
$siteCollURL = Read-Host “Enter SiteCollection URL”
$fileExt = Read-Host “Enter file extension”
#get all spwebs and file count
$spWebs = Get-SPSite “$siteCollURL” | Get-SPWeb -Limit ALL | Select -ExpandProperty Lists | ?{$_.GetType().Name -eq “SPDocumentLibrary”} | Select -ExpandProperty Items | ?{$_.Name -like “*$fileExt”}
$fileCount = $spWebs.Count
Write-Host “There are a total of $fileCount $fileExt files”
The script above works fine but is there a way to also get the value for SPSite as well and have the value of $fileCount be the sum of the 2; doc libraries and lists? I tried using a compound ? clause but that didn’t seem to work; ?{$_.GetType().Name -eq “SPDocumentLibrary”) -and ($_.GetType().Name -eq “SPList”)}
I was able to accomplish my task by using the following script..
#get user input
$siteCollURL = Read-Host “Enter SiteCollection URL”
$fileExt = Read-Host “Enter file extension”
#get all spwebs and file count
$spWebs = Get-SPSite “$siteCollURL” | Get-SPWeb -Limit ALL | Select -ExpandProperty Lists | ?{$_.GetType().Name -eq “SPDocumentLibrary” -or “SPList”} | Select -ExpandProperty Items | ?{$_.Name -like “*$fileExt” -or $_.SPListItem.Attachments -like “*$fileExt”}
$fileCount = $spWebs.Count
Write-Host “There are a total of $fileCount $fileExt files in the $siteCollURL Site Collection”
This will total up the Document Library and List Attachments of the file extension that gets stored in the $fileExt variable.
Typo in my discussion.. should be — The script above works fine but is there a way to also get the value for “SPList”
Try this:
Get-SPSite “$siteCollURL” | Get-SPWeb -Limit ALL | Select -ExpandProperty Lists |
  Where {  $_.BaseTemplate -eq “DocumentLibrary” } |
  Select -ExpandProperty Items |
  Where { $_.Name -Like “*$fileExt” } |
  Select Name,
     @{Name=”URL”;
     Expression={$_.ParentList.ParentWeb.Url + “/” + $_.Url}}