There will come a time when you have to determine the total size of your Microsoft Exchange Online mailbox, or an individual mailbox’s size? Sometimes you will want to know the Item counts per mailbox, or the counts for the all the mailboxes. Is there an easy way to do this? Well, read on …
As this is the first blog post of 2019, let me wish everyone a Happy New Year.
Back to our MS Exchange Online size and item count discussion; in this blog post, I will show you the easy way to determine the size and item counts per mailbox of your MS Exchange Online (MS Office 365) using PowerShell. Let’s get started:
Connect to Office 365
Before you start working with the Powershell commands, you must connect to the MS Exchange Online Powershell using the following commands:
$office365Credential = Get-Credential $global:office365= New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $office365Credential -Authentication Basic –AllowRedirection Import-PSSession $office365
Using those commands, you can login to your subscription using your username and password.
Note: Be sure to disconnect the remote PowerShell session when you’re finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and then you’ll have to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command:
Remove-PSSession $Session
MailBox Size and Items Count
To get the information you will need, mailbox size and Items count, we will use the Get-Mailbox command to specify the desired output:
get-mailbox | get-mailboxstatistics | ft displayname, totalitemsize, ItemCount
The output from that command will be the Mailbox display name, Total Item Size, and the Total Item Count, as follows:
In the case where you have many mailboxes, and you want to export the output to MS Excel to make it easier for working with the data, you can use the following command:
Get-Mailbox -ResultSize unlimited | Get-MailboxStatistics | Select DisplayName,TotalItemSize, ItemCount | Sort-Object -Property TotalItemSize -Descending | export-csv -path C:\temp\sizes.csv
With that command, the output will be enclosed within a single MS Excel file.
Summary
On this blog post I showed you the easy way to help customers and partners to size their MS Exchange Online backups. This basic blog post must be your starting point to get more info from the MS Office 365 environment, like getting the size of the SharePoint and OneDrive data stores. If you want an even easier way of getting this information, and to generate reports, I recommend trying an excellent tool called: AdminDroid: https://admindroid.com/ (15 days trial). Till next time…
What do you think?
Is there a way to export only in MB? Columns are mixed with ex 1.23GB and 30.30MB
This isn’t very useful as you can’t easily sort, add or analyse the data since it isn’t reported in a consistent unit.
Hi Campbell, thanks for your feedback, but this tool does not design to perform the tasks you noted.
What about the TotalDeletedItemSize. You can have a TotalItemSize of 1GB and a TotalDeletedItemSize of 30GB.