Solved

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

Posted on 2010-11-23
11
1,338 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 25

Expert Comment

by:Tony1044
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
 
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
Will my email signature work in Office 365?

You've built an email signature using raw HTML code in Office 365, but you can't review how it looks with Transport Rules. So you have to test it over and over again before it can be used. Isn't this a bit of a waste of your time? Wouldn't a WYSIWYG editor make it a lot easier?

 
LVL 70

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 70

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 70

Accepted Solution

by:
Chris Dent earned 500 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 70

Expert Comment

by:Chris Dent
ID: 34196990

With Export-Csv as well?

Chris
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create a Contact 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 Recipients >> Contact ta…
In this video we show how to create a mailbox database 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 Servers >> Data…

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now