Get Mail Box Size report Organization Unit wise
Hi Experts,
i getting user mailbox report by below script , but i want to add one Organization unit Column also.
pls Help
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select DisplayName, LastLoggedOnUserAccount, ItemCount, StorageLimitStatus, @{expression={$_.TotalItemSize.value.ToMB()}} | Export-CSV E:\Report\MailboxSizes_07_June_2010.csv
Rgds,
Balwan Singh
June 7th, 2010 10:44am
Hi,
Get-MailboxStatistics does not provide this attribute. You can use custom object instead and club the output from two commands. To include Org Unit you can use Get-mailbox cmdlet.
#Starts
$ObjCol = @()
Get-mailbox | Foreach {
$ObjRow = New-object system.object
$ObjRow | add-member -MemberType NoteProperty -Name Displayname -Value $_.DisplayName
$ObjRow | add-member -MemberType NoteProperty -Name LastLoggedOnUserAccount -Value (Get-mailboxstatistics -id $_).LastLoggedOnUserAccount
$ObjRow | Add-Member -MemberType NoteProperty -Name ItemCount -Value (Get-mailboxstatistics -id $_).ItemCount
$ObjRow | Add-Member -MemberType NoteProperty -Name StorageLimitStatus -Value (Get-mailboxstatistics -id $_).StorageLimitStatus
$ObjRow | Add-Member -MemberType NoteProperty -Name TotalItemSize -Value (Get-mailboxstatistics -id $_).TotalItemSize.value.toMB()
$ObjRow | Add-Member -MemberType NoteProperty -Name OrganizationalUnit -Value $_.OrganizationalUnit
$ObjCol += $ObjRow
}
#Now $ObjCol is a new object which contains the mix of two commands. you can also add other attributes as well the same way. Below is to Sort and Export the Object.
$ObjCol | Sort TotalItemSize -Descending | Export-CSV E:\Report\MailboxSizes_07_June_2010.csv
#End
Hope this works for you.
Thanks
Vishal Ramnani
MCITP - Exchange 2007,
MCSE Messaging,
MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
June 7th, 2010 11:36am
Hi Vishal,
Great Job!
But you can not get the right value using ToMB(), see this post:
http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/96a5dfe8-6e06-4294-81b7-a2b49196d7dd
Frank Wang
June 9th, 2010 12:26pm