This PowerShell script will get the count of all site collections in a web application
param($Site,$FilePath)
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
function GenerateAllSitecollectionsCountInWebapplication ($url)
{
write-host "Extracting the count of site collections in web application....." -foregroundcolor black
try
{
$Site=Get-SPSite $url
$spWebApp = $Site.WebApplication
write-host Total count in $url is $Site.WebApplication.Sites.Count -foregroundcolor red
}
catch
{
write-host "Unable to Extract Sitecollection count .." -foregroundcolor red
break
}
}
GenerateAllSitecollectionsCountInWebapplication -Url "Web application URL"
No comments:
Post a Comment