Solved

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

Posted on 2010-11-23
11
1,351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Johncock
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
Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

 
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 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 71

Expert Comment

by:Chris Dent
ID: 34196990

With Export-Csv as well?

Chris
0

Featured Post

What, When and Where - Security Threats from Q1

Join Corey Nachreiner, CTO, and Marc Laliberte, Information Security Threat Analyst, on July 26th as they explore their key findings from the first quarter of 2017.

Question has a verified solution.

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

Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

623 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