Answered by:
Getting mailbox size by OU

Question
-
I'm trying to find out the size of mailboxes by organizational units, does anyone know the shell command for this? Thanks in advance for any help.
FLaidmanThursday, October 20, 2011 4:03 PM
Answers
-
I stand corrected. From an EMS that doesn't work. From the Modules PS session (with the snapin loaded it does). Having to pretend there's a "cloud" between me and the server in the next room bit me. Again.
[PS] C:\>get-mailbox -organizationalunit "ou=C001,ou=non-user mailboxes,dc=munged,dc=com" -resultsize unlimited |
get-mailboxstatistics | select displayname,@{label="TotalItemsize";expression={$_.totalitemsize.value.tobytes()}} |
measure-object totalitemsize -sum
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "Monday, October 24, 2011 8:14 PM
All replies
-
Exchange version?
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "Thursday, October 20, 2011 4:23 PM -
upss, we're running Exchange 2010 SP1
FLaidmanThursday, October 20, 2011 4:41 PM -
get-mailbox -organizationalunit <ou> | get-mailboxstatistics
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "Thursday, October 20, 2011 4:50 PM -
Hi Fred,
mjolinor is right.
get-mailbox -organizationalunit <ou> | get-mailboxstatistics | fl
This command is better.
Thanks.
Best Regards!Friday, October 21, 2011 3:01 AM -
Thank you all, I'll give it a try
FLaidmanMonday, October 24, 2011 1:05 PM -
I've tried the command and it works for the most part, as it gave me the individual sizes by OU; however I also need the total for the entire OU. Any other suggestions for this, and thanks again.
FLaidmanMonday, October 24, 2011 4:01 PM -
See get-help measure-object -full
(get-mailbox -organizationalunit <ou> | get-mailboxstatistics | measure-object -sum totalitemsize).sum
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "Monday, October 24, 2011 4:27 PM -
Thanks for the suggestion, I've tried the command and I get this error for each mailbox (with different object sizes of course):
Measure-Object : Input object "68.43 KB (70,072 bytes)" is not numeric.
At line:1 char:94
I've also read the help info for that command and I don't see anything that can help get the total size by OU, any other suggestion is appreciated.
Thanks,
FLaidmanMonday, October 24, 2011 7:16 PM -
Don't know where to go from there.
I'm running E2010 SP1, and using that command line, I get this running it against one of my OU's .
PS C:\> (get-mailbox -Organizationalunit "ou=C001,ou=non-user mailboxes,dc=munged,dc=com" -resultsize unlimited | get-mailboxstatistics | measure-object totalitemsize -sum).sum
638465966
PS C:\>The -organizationalunit parameter on get-mailbox piped to get-mailboxstatistics will give you the stats per OU. Piping that to measure object -sum totalitemsize should get you the sum for that OU.
If you're wanting a cmdlet that will just spit out a report of the mailboxes, grouped by OU along with their item statistics and a summary total per OU, (and maybe a grand total after that we don't know about yet), I don't think there is one.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "Monday, October 24, 2011 7:52 PM -
I stand corrected. From an EMS that doesn't work. From the Modules PS session (with the snapin loaded it does). Having to pretend there's a "cloud" between me and the server in the next room bit me. Again.
[PS] C:\>get-mailbox -organizationalunit "ou=C001,ou=non-user mailboxes,dc=munged,dc=com" -resultsize unlimited |
get-mailboxstatistics | select displayname,@{label="TotalItemsize";expression={$_.totalitemsize.value.tobytes()}} |
measure-object totalitemsize -sum
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "Monday, October 24, 2011 8:14 PM -
Ok I'll give that a try, in any case I only need the total size by OU. I don't really care for individual mailbox stats, what really important is the overall total size. I'll let you know, thanks again.
FLaidmanMonday, October 24, 2011 8:28 PM -
I know this is an old thread but it came up on a google search. I did this to find sizes for individual boxes in an OU, sorted by largest to smallest
get-mailbox -organizationalunit "ou=users,dc=contoso,dc=com" | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,@{Label="Size(Mb)"; Expression={$_.TotalItemSize.Value.ToMb()}} -First 50 | ft -auto
maybe that will help someone else.
-Tom
- Proposed as answer by Ron Proschan Friday, September 6, 2013 3:42 AM
Tuesday, March 12, 2013 3:14 PM -
Wonderful cmdlet!!!
Ron Proschan
Friday, September 6, 2013 3:43 AM -
That is, the one that Thomish sent in March is fantastic.
Ron Proschan
Friday, September 6, 2013 3:43 AM -
The below command will get your target.
Get-Mailbox –OrganizationalUnit "OUName" -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize | Export-CSV OU-Users-MB-Size.csv
Cheers,
Mahmoud Hanafi
Senior Exchange|Lync Administrator
Blog:Twitter:
LinkedIn:
Facebook:
Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Wednesday, August 12, 2015 2:13 PM