Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


PowerShell - Exchange - Mailbox Size

Posted on 2011-03-03
Medium Priority
Last Modified: 2012-05-11
So I am trying to get a list of my users mailbox size (I just took over here and they dont have a mailbox limit).  the command that I have is:

Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

Everytime I run this command on the EMS I get the following:

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "" to type "Microsoft.Exchange.Con
figuration.Tasks.GeneralMailboxOrMailUserIdParameter". Error: "Parameter values of type Microsoft.Exchange.Configuratio
n.Tasks.GeneralMailboxOrMailUserIdParameter can't be empty. Specify a value, and try again.
Parameter name: identity"
    + CategoryInfo          : InvalidData: (:) [Get-MailboxStatistics], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-MailboxStatistics

So I am thinking somewhere I am not telling the script that I need everyuser - thus the Identity error.

Question by:Travis Hahn
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
  • 2
  • 2
  • 2
LVL 20

Expert Comment

by:Satya Pathak
ID: 35028574
LVL 71

Expert Comment

by:Chris Dent
ID: 35028898

Can you try:
Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | 
  Select-Object DisplayName, @{name="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}, ItemCount

Open in new window

I seem to remember they modified the behaviour of Get-MailboxStatistics a little for Exchange 2010. I swapped in Select-Object for FT (Format-Table) as well, this will allow you to pipe to a CSV file if you wish. e.g.
Get-Mailbox | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | 
  Select-Object DisplayName, @{name="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}, ItemCount |
  Export-Csv "YourFile.csv" -NoTypeInformation

Open in new window



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


Author Comment

by:Travis Hahn
ID: 35029004
Chris that was PERFECT.  So what I see is that I needed to call the "get-Mailbox" before I could get MailBoxStatistics.

Is that correct?
LVL 71

Accepted Solution

Chris Dent earned 2000 total points
ID: 35029030

Yes, indeed.

Exchange 2007 has a default value, so Get-MailboxStatistics on its own is fine. Most of the examples you find kicking around will be for Exchange 2007.

They changed that with 2010, now you need to be specific, or if you want everyone you have to pipe through something else (like Get-Mailbox).

Finally, if you have a lot of users you may need to add "-ResultSize Unlimited". e.g.
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Sort-Object TotalItemSize -Descending | 
  Select-Object DisplayName, @{name="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}}, ItemCount |
  Export-Csv "YourFile.csv" -NoTypeInformation

Open in new window


Author Closing Comment

by:Travis Hahn
ID: 35029075
Thank YOU Chris

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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
how to add IIS SMTP to handle application/Scanner relays into office 365.

705 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