Having a large number of test mailboxes can benefit from a report that shows the size of all mailboxes.
If you want to check an individual mailbox, you can do it with a single command.
1 |
Get-MailboxStatistics -Identity username@domain.com | Select-Object DisplayName, TotalItemSize |
The result of this command will be:
What if we have many mailboxes? I’ve written a script that allows checking the sizes of all mailboxes and displays them in a report.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
################################# ### ITAdminBlog.pl ############## ################################# $Mailboxes = Get-ExoMailbox -ResultSize Unlimited $MailboxData = @() [Int]$50GB = 51200 #max size of mailbox foreach ($mailbox in $Mailboxes) { $TotalMB = ( $Mailbox | Get-ExoMailboxStatistics).TotalItemSize.Value.ToMB() $TotalGB = [Math]::Round($TotalMB / 1024, 1) $percentUsed = ($TotalMB/$50GB)*100 #.tostring("P") $ProgressBar = "[" + ("#" * [Math]::Round($percentUsed / 10)) + (" " * (10 - [Math]::Round($percentUsed / 10))) + "]" $MailboxData += [PSCustomObject]@{ "Mailbox Name" = $mailbox.DisplayName "UPN" = $mailbox.UserPrincipalName "Mailbox Size (GB)" = ($TotalGB).ToString() + " GB" "Mailbox Size [%]" = ($percentUsed/100).ToString("P") "Progress bar" = $ProgressBar } } # Show data in table $MailboxData | Format-Table -AutoSize |
The result of this script will be a table like this:
Of course, you can export this result to CSV, HTML, or display it as an interactive table using Out-Grid.