Solved

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

Posted on 2010-11-23
11
1,344 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: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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

820 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