Office 365 Groups are nothing but a hidden site collection with mailbox that are not visible in Site Collections view in Office 365 tenant Admin portal. You can only access these site collections by using PowerShell or through URL (https://<tanentname><group-name>/Shared documents”).

Often, Office 365 administrators need to find the storage used by Office 365 Groups since this storage gets the storage quota of the SharePoint Site Collections. In this post, I am going to write a Powershell script to find storage used by Office 365 Groups.

We can use the SharePoint Online Powershell cmdlet Get-SPOSite to get current site storage size and storage quota. Before proceeding, run the following command to connect Sharepoint Online Powershell module.

Connect-SPOService -Url https://<tanentname>
-Credential [email protected]

Now run the below script after replacing the <tanentname> and <group-name> with your own tenant name and group name.

$O365GroupSiteUrl ="https://<tanentname><group-name>"
$O365GroupSite = Get-SPOSite -Identity $O365GroupSiteUrl
$StorageSize =$O365GroupSite.StorageUsageCurrent
Write-Host "Storage  used (MB): " $StorageSize " MB" -ForegroundColor Yellow
Write-Host "Storage  used (GB): " ($StorageSize/1024) " GB" -ForegroundColor Yellow

Get the current Storage Size for all Office 365 Groups:

$userName ="[email protected]<tanentname>"
$o365Cred = Get-Credential -UserName $userName -Message "Enter Office 365 Admin Credentials"
$o365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $o365Cred -Authentication Basic -AllowRedirection
Import-PSSession $o365Session
$spoAdminUrl ="https://<tanentname>"
Connect-SPOService -Url $spoAdminUrl -Credential $o365Cred
$O365Groups = Get-UnifiedGroup -ResultSize Unlimited
[email protected]()
ForEach ($O365Group in $O365Groups){
If($O365Group.SharePointSiteUrl -ne $null) { $O365GroupSite=Get-SPOSite -Identity $O365Group.SharePointSiteUrl
$CustomResult += [PSCustomObject] @{
GroupName =  $O365Group.DisplayName
SiteUrl = $O365GroupSite.Url
StorageUsed_inMB = $O365GroupSite.StorageUsageCurrent
StorageQuota_inGB = $O365GroupSite.StorageQuota/1024
WarningSize_inGB =  $O365GroupSite.StorageQuotaWarningLevel/1024
$CustomResult | FT

You can also export the output into CSV file:

$CustomResult | Export-CSV "C:\\O365-Group-Storage-Info.csv" -NoTypeInformation -Encoding UTF8

Read more

Manage Office 365 Groups with PowerShell



Was this article helpful?

Ready to get started?

Maximize the value of Office 365 with Inscape

Start your Inscape free trial