Mailbox Size Office 365 with Powershell

20 בOctober 2017

תגיות:
אין תגובות

We can get mailboxes size by running very simple queries toward  Office 365.

The command I would like to use is get-MailboxStatistics which known as an important cmdlet and helps us to obtain necessary information about Mailbox.
I am going to show you several good examples which show you what is the total current use of the mailbox and how to convert is to Mb.
— Do not forget login to PowerShell with your Office 365 global administrator credentials.

The below outcome shows us the mailbox size and total time for my user

Get-MailboxStatistics -Identity 'Meir' | Select DisplayName,ItemCount,TotalItemSize

How to get same results but for all office 365 mailboxes:

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics |
Select-Object -Property @{label=”User”;expression={$_.DisplayName}},
@{label=”Total Messages”;expression= {$_.ItemCount}},
@{label=”Total Size (MB)”;expression={[math]::Round(`
($_.TotalItemSize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1MB),2)}}

You also can sort it to a list by mailbox size in descending order:

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics |

 

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics 
| Select-Object -Property @{label=”User”;expression={$_.DisplayName}},
@{label=”Total Messages”;expression= {$_.ItemCount}},
@{label=”Total Size (MB)”;expression={[math]::Round(`
($_.TotalItemSize.ToString().Split("(")[1].Split(" ")[0].Replace(",","")/1MB),2)}} |
Sort "Total Size (MB)" -Descending

 

הוסף תגובה
facebook linkedin twitter email

Leave a Reply

Your email address will not be published. Required fields are marked *