How to get the mailbox size for each and total of a specific OU ?

Hi,

By using Powershell, is there any way to get the mailbox size for each of the member of specific OU and display the total at the bottom ?

This is for Exchange Server 2007
LVL 8
Senior IT System EngineerIT ProfessionalAsked:
Who is Participating?
 
SubsunConnect With a Mentor Commented:
For per mailbox MB & total MB
$UserList | Select Displayname,@{N="TotalItemSize in MB";E={$_.TotalItemSize.value.toMB()}};`
Write-host "`nTotal mailbox size $(($UserList | %{$_.TotalItemSize.value.toMB()} | Measure-Object -Sum).sum) MB"

Open in new window

For per mailbox GB & total GB
$UserList | Select Displayname,@{N="TotalItemSize in GB";E={$_.TotalItemSize.value.toGB()}};`
Write-host "`nTotal mailbox size $(($UserList | %{$_.TotalItemSize.value.toGB()} | Measure-Object -Sum).sum) GB"

Open in new window

0
 
SubsunCommented:
Try this..
$UserList = Get-mailbox –OrganizationalUnit “Domain.com/IT/Users” -ResultSize Unlimited | Get-MailboxStatistics
$UserList | Select Displayname,TotalItemSize;`
Write-host "`nTotal mailbox size $(($UserList | %{$_.TotalItemSize.value.toMB()} | Measure-Object -Sum).sum) MB"

Open in new window

If required you can export the details to .csv file using
$UserList | Select * | Export-Csv C:\report.csv -NoTypeInformation
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
Senior IT System EngineerIT ProfessionalAuthor Commented:
Subsun,
Thanks for the script,
but somehow the ItemSize is still displayed in Bytes, any idea how to change it into Mega Bytes or even Gigabytes ?
0
 
SubsunConnect With a Mentor Commented:
Try
$UserList = Get-mailbox –OrganizationalUnit “Domain.com/IT/Users” -ResultSize Unlimited | Get-MailboxStatistics
$UserList | Select Displayname,@{N="TotalItemSize in MB";E={$_.TotalItemSize.value.toGB()}};`
Write-host "`nTotal mailbox size $(($UserList | %{$_.TotalItemSize.value.toMB()} | Measure-Object -Sum).sum) MB"

Open in new window


If you change the $_.TotalItemSize.value.toMB() to $_.TotalItemSize.value.toGB(), the you will get the result in GB..
0
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
thanks, that only changes the total sum at the bottom but not per mailbox size ?
0
 
Senior IT System EngineerIT ProfessionalAuthor Commented:
Thanks !
0
All Courses

From novice to tech pro — start learning today.