How to display mailbox sizes sorted by size
Below a small powershell script with which you can connect to Office 365 and retrieve all mailboxes by size.
# Prequisites:
# Install Chocolatey
# Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install Powershell Version 5.1
# choco install powershell
# InstallAzure Active Directory PowerShell Module
# Install-Module -Name MSOnline
# Office 365 Credentials
$Office365Cred = Get-Credential -Message "Office 365 Credentials" -UserName "<xxx@xxxx.xxx>"
# Connecting Office 365
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Office365Cred -Authentication Basic –AllowRedirection
Import-PSSession $Session -AllowClobber
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select-Object DisplayName, @{Name="TotalItemSizeMB"; Expression={[math]::Round(($_.TotalItemSize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1MB),0)}}, ItemCount | Sort-Object -Property TotalItemSizeMB -Descending
Remove-PSSession $Session
Result:
What is this good for now?
Again, I can only speak from my own experience.
With this list, I was able to determine which users needed a larger mailbox quota.
Additionally, there is also an archiving feature in Office 365.
From a size of about 25GB per mailbox this makes sense.
Anyone who has troubleshooted corrupt OST files (Outlook Chache Files) knows that a resync (i.e. a completely new synchronization from the cloud) takes time and puts a strain on the line.
This often places a heavy strain on the nerves of the person concerned.
If you archive in time, you can avoid such situations.
Conclusion: So also in this case an overview would be handy, which mailboxes are potential candidates for archiving.