Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I make alist of the mailbox'es based on size?

Posted on 2010-11-23
11
Medium Priority
?
1,365 Views
Last Modified: 2012-05-10
I want to make a list of all the mailboxes in a database, and I want to sort it decending based on the size of the mailboxes. In Exchange 2003 you could do this in the GUI, but no more for some reason. So I found a commando that should do this: "Get-MailboxStatistic -Database "DBname"

But it doesnt list the size of the mailboxes. I found out how to do this in Exchange 2007: [PS] C:\Windows\system32>Get-MailboxStatistics |ft DisplayName,TotalItemsSize,ItemCount,StorageLimitStatus

But this doesnt work in Exchange 2010. When I try I get a response asking about which mailbox I wish to list:

cmdlet Get-MailboxStatistics at command pipeline position 1
Supply values for the following parameters:
Identity:


The problem is that I want to include ALL the mailboxes in the DB. So how do I do this?
0
Comment
Question by:NAF-Data
11 Comments
 
LVL 33

Expert Comment

by:Busbar
ID: 34195798
you will need to do:
get-mailbox -database dbname | Get-MailboxStatistics |ft DisplayName,TotalItemsSize,ItemCount,StorageLimitStatus
0
 

Author Comment

by:NAF-Data
ID: 34195821
Im I typing wrong here? I dont get any result

[PS] C:\Windows\system32>Get-Mailbox -database DB01 |Get-MailboxStatistics|ft DisplayName,TotalItemSize,ItemCount,StorageLimitStatus
[PS] C:\Windows\system32>
0
 
LVL 26

Expert Comment

by:Tony J
ID: 34195989
Try this:

Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}} -auto

Or if they're monsters you could change to show in GB:

Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (GB)”;expression={$_.TotalItemSize.Value.ToGB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}} -auto
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 10

Expert Comment

by:abhijitmdp
ID: 34196079
Use below command from EMC or powershell

Get-MailboxStatistics | where {$_.ObjectClass –eq “Mailbox”} |Sort-Object DisplayName | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}} | out-file C:\MailboxList.csv

This will generate a csv file in your c:
0
 

Author Comment

by:NAF-Data
ID: 34196613
Something is wrong, I still dont get any output. I tried both tip:

[PS] C:\Windows\system32>Get-MailboxStatistics | where {$_.ObjectClass -eq "Mailbox"} | Sort-Object TotalItemSize -Desce
nding | ft @{label="User";expression={$_.DisplayName}},@{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB
()}},@{label="Items";expression={$_.ItemCount}},@{label="Storage Limit";expression={$_.StorageLimitStatus}} -auto


cmdlet Get-MailboxStatistics at command pipeline position 1
Supply values for the following parameters:
Identity:



---------------------------------------------------------



[PS] C:\Windows\system32>Get-MailboxStatistics | where {$_.ObjectClass -eq "Mailbox"} |Sort-Object DisplayName | ft @{la
bel="User";expression={$_.DisplayName}},@{label="Total Size (MB)";expression={$_.TotalItemSize.Value.ToMB()}} | out-file
 C:\MailboxList.csv


cmdlet Get-MailboxStatistics at command pipeline position 1
Supply values for the following parameters:
Identity:
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 34196792
Hello there,

You want this:
Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | 
  Select-Object DisplayName, TotalItemSize, ItemCount, StorageLimitStatus | Export-Csv "MailboxList.csv" -NoTypeInformation

Open in new window

HTH

Chris
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 34196808

Sorry, you wanted a specific database, didn't you?
Get-MailboxStatistics -Database "Some Database" | Sort-Object TotalItemSize -Descending | 
  Select-Object DisplayName, TotalItemSize, ItemCount, StorageLimitStatus | Export-Csv "MailboxList.csv" -NoTypeInformation

Open in new window

Chris
0
 

Author Comment

by:NAF-Data
ID: 34196884
I get a .csv file, but it is only 1 Kb. I open it in Excel and it only fills some weird signs in the first cell. Nothing more. I suspect something is wrong here, but I dont understand what. I have 4 mailservers, 2 HUB/CAS and 2 MBX. divided into 2 different sites, all of the servers are Exchange 2010 that I have upgraded to SP1, and they run on Windows 2008 R2. I run the script on the MBX server in Site A where the database is active. Any chance of this making some problem?
0
 
LVL 71

Accepted Solution

by:
Chris Dent earned 2000 total points
ID: 34196957

Nope, that should be fine. You used the version with Export-CSV above? Perhaps run this first and make sure you get something back:
Get-MailboxStatistics -Database "Some Database" | Sort-Object TotalItemSize -Descending | 
  Select-Object DisplayName, TotalItemSize, ItemCount, StorageLimitStatus

Open in new window

Chris
0
 

Author Comment

by:NAF-Data
ID: 34196984
That worked, dont know why the other didnt. Now I got a decending list based on the size. Thnx
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 34196990

With Export-Csv as well?

Chris
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
If you have come across a situation where you need to find some EDB mailbox recovery techniques, then here you will find the same. In this article, we will take you through three techniques using which you will be able to perform EDB recovery. You …
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
Screencast - Getting to Know the Pipeline

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question