Thursday, 8 May 2014

List All site Collections

This will list all the web application and some details about their site collections

Clear-Host
[Void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

function GetSiteDetails()
{
    foreach ($site in Get-SPWebApplication | Get-SPSite)
    {
        $data = @{"Url" = $site.url
                  "Root Web" = $site.rootweb
                  "Template" = $site.rootweb.WebTemplate
                   "Web Application" = $site.webApplication
                  }
        New-Object PSObject -Property $data
    }
}


GetSiteDetails | Out-GridView