Running this script will generate a report, which displays the list of site collections that has multiple site collection administrators and will also display the total number of users who have access to those site collections.

  1. Add - PSSnapin microsoft.sharepoint.powershell - ErrorAction SilentlyContinue
  2. Add - Content "Sites.csv" - Value "SiteCollection Name,SiteCollection URL, SiteCollection Administrators, Users Count,Usage in MB"
  3. $webApp = Get - SPWebApplication
  4. foreach($webapps in $webapp)
  5. {
  6. foreach($SiteCollection in $webApps.Sites)
  7. {
  8. $url = $SiteCollection.Url
  9. $webs = Get - SPWeb $URL[boolean] $WriteToFile = $true
  10. $weburl = $SiteCollection.OpenWeb()
  11. $siteowner = ""
  12. foreach($siteAdmin in $weburl.SiteAdministrators)
  13. {
  14. $siteowner = $siteAdmin.DisplayName + "|" + $siteowner
  15. }
  16. foreach($web in $webs)
  17. {
  18. #Grab all users in the site collections
  19. $siteUserCnt = $web.AllUsers.Count
  20. $Siteurl = $web.Url
  21. $siteTitle = $web.Title
  22. $site = Get - SPSite $Siteurl
  23. $siteusage = $site.Usage.Storage / 1 MB
  24. Add - Content - Path "Sites.csv" - Value "$siteTitle,$Siteurl,$siteowner,$siteUserCnt,$siteusage"
  25. $web.Dispose()
  26. }
  27. }
  28. }
Thanks for using this script. Happy SharePointing.