0

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”)}

(Visited 141 times, 1 visits today)
Add a Comment