Find All Office 365 Group Sites in SharePoint Online

Requirement: Get All Group Sites in SharePoint Online.

How to find all group-connected team sites in SharePoint Online?
The new SharePoint Online admin center lists all group sites and modern sites. You can login to SharePoint Online Admin Center >> Click on "Active Sites" and then look for "Primary Admin" Column which has "Group Admin" to get the list of all SharePoint Online group site collections.
find all group sites in sharepoint online


SharePoint Online: List Group Sites using PowerShell 
Run these lines of PowerShell script in SharePoint Online Management Shell.
#Set Admin Center URL
$AdminCenterURL = "https://crescent-admin.sharepoint.com/"

#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Get All Group Sites
Get-SPOSite | Where { $_.Template -like 'GROUP*'} | Select URL

This gets you the list of all group sites!  

Get All Group Sites in SharePoint Online and Export to CSV:
Gets get a list of group sites and export the data to CSV file.
#Set Admin Center URL
$AdminCenterURL = "https://crescent-admin.sharepoint.com/"
$ReportOutput="C:\Temp\GroupSites.csv"

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)

#Get All Group Sites
$GroupSites = Get-SPOSite -Limit All -Template 'GROUP#0' -IncludePersonalSite:$False
Write-host "Total Number of Group Sites Found:"$GroupSites.count

$SiteData = @()
#Loop throgh each site
ForEach($Site in $GroupSites)
{
    #Get Group Site Data
    $SiteData += New-Object PSObject -Property @{
                'Site Title' = $Site.Title
                'URL' = $Site.Url
                'Last Modified' = $Site.LastContentModifiedDate
                'StorageUsed' = $Site.StorageUsageCurrent              
                }
}
#Export the data to CSV
$SiteData | Export-Csv $ReportOutput -NoTypeInformation
Write-Host -f Green "Group Sites Data Exported to CSV!"
and the script output report:
sharepoint online list group sites

Get Group Sites using Exchange Online PowerShell
#Get Credentials to connect
$Credential = Get-Credential
 
#Create the session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
           -Credential $Credential -Authentication Basic -AllowRedirection
 
#Import the session
Import-PSSession $Session -DisableNameChecking

#Get All Office 365 Groups
$Groups = Get-UnifiedGroup -ResultSize Unlimited -SortBy Name
        $GroupSites = @()
        $Groups | Foreach-Object {
            $Group = $_
            $SiteURL = $Group.SharePointSiteUrl
            If($SiteURL -ne $null){
                $GroupSites += New-Object -TypeName PSObject -Property @{
                      GroupName = $Group.Alias
                      GroupUrl = $SiteURL
                      EmailAddress = $Group.EmailAddress
                      DisplayName = $Group.DisplayName
                      Privacy = $Group.AccessType
                      Owners = $Group.ManagedBy
                      Created = $Group.WhenCreated
                      Changed = $Group.WhenChanged
                }
            }
        }
        $GroupSites
#Remove the session
Remove-PSSession $Session
Find All Office 365 Group Sites in SharePoint Online Find All Office 365 Group Sites in SharePoint Online Reviewed by Salaudeen Rajack on November 23, 2017 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.