Get All Site Collections with Titles

By | July 26, 2016

Simple and easy way to get all site collections with Title.

  
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
  
function GenerateAllSitecollectionsInWebapplication ($url)
{
    write-host "Sitecollection List Extraction started...." -foregroundcolor red
    try
      {
         $Site=Get-SPSite $url         
         $spWebApp = $Site.WebApplication

         foreach($SC in $spWebApp.Sites)
         {
           write-host $SC.Url  - $SC.RootWeb.Title     
         }                       
      }
   catch
      {
          write-host "Unable to Extract Sitecollection List..." -foregroundcolor red
          break
      }

 
GenerateAllSitecollectionsInWebapplication  -Url "https://SharePoint.com"