How to get the storage used by Office 365 groups in SharePoint online?

Featured image

When a new Office 365 Group is created, it also creates an accompanying file store. The files uploaded to the Office 365 Groups’ file store are actually stored in an corresponding SharePoint Online Document Library in the SharePoint Online site collection

which means that the storage used by Office 365 Groups occupies the storage quota of the SharePoint Online tenant. As a result, Office 365 admins need a way to track the storage used by Office 365 groups, so in this blog we share the steps to get the Storage used by Office 365 Groups using PowerShell.

Before starting the process, download and install the SharePoint Online Management Shell from this link and execute the following PowerShell Scripts in the SharePoint Online Management Shell by connecting to SharePoint Online or Exchange Online using Global Administrator credentials.

How to get the Storage used by a Specific Office 365 Group

Input Parameters Required $SPOAdminCenterUrl - Office 365 SharePoint Admin URL $GName - Office 365 Group Name

Following PowerShell script is used to get the Storage used by a Specific Office 365 Group,

# Get values for input parameters:

$credential = get-credential 
$SPOAdminCenterUrl="https://DomainName-admin.sharepoint.com/"
$GName= “o365GroupName”


# Connect to SharePoint Online and Exchange Online 

Connect-SPOService -Url $SPOAdminCenterUrl -Credential $credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic -AllowRedirection
Import-PSSession $Session


# Getting Value from Specific Group

$Group=Get-UnifiedGroup –identity $GName
$SPO365GroupFilesUrl = $Group.SharePointSiteUrl
$site=Get-SPOSite -Identity $SPO365GroupFilesUrl -Detailed
      New-Object -TypeName PSObject -Property @{      
      GroupName=$site.Title
      CurrentStorageInMB=$site.StorageUsageCurrent
      StorageQuotaInMB=$site.StorageQuota
      StorageQuotaWarningLevelInMB=$site.StorageQuotaWarningLevel      
}|select GroupName, CurrentStorageInMB, StorageQuotaInMB, StorageQuotaWarningLevelInMB

How to get the Storage used by all Office 365 Groups

Input Parameters Required $SPOAdminCenterUrl - Office 365 SharePoint Admin URL

Following PowerShell script is used to get the Storage used by all Office 365 Groups,

# Get values for input parameters:

$credential = get-credential 
$SPOAdminCenterUrl="https://DomainName-admin.sharepoint.com/"


# Connect to SharePoint Online and Exchange Online 

Connect-SPOService -Url $SPOAdminCenterUrl -Credential $credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange –ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic -AllowRedirection
Import-PSSession $Session


# Getting Value from all Office 365 Groups

$Groups=Get-UnifiedGroup
$Groups | Foreach-Object{
$Group = $_
$site=Get-SPOSite -Identity $Group.SharePointSiteUrl -Detailed
      New-Object -TypeName PSObject -Property @{
      GroupName=$site.Title
      CurrentStorageInMB=$site.StorageUsageCurrent
      StorageQuotaInMB=$site.StorageQuota
      StorageQuotaWarningLevelInMB=$site.StorageQuotaWarningLevel
}}|select GroupName, CurrentStorageInMB, StorageQuotaInMB, StorageQuotaWarningLevelInMB