Solved

PowerShell - Exchange - Mailbox Size

Posted on 2011-03-03
6
2,022 Views
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.

Help...
0
Comment
Question by:Travis Hahn
  • 2
  • 2
  • 2
6 Comments
 
LVL 20

Expert Comment

by:Satya Pathak
ID: 35028568
0
 
LVL 20

Expert Comment

by:Satya Pathak
ID: 35028574
0
 
LVL 70

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

HTH

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

 

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?
0
 
LVL 70

Accepted Solution

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

Chris
0
 

Author Closing Comment

by:Travis Hahn
ID: 35029075
Thank YOU Chris
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

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 explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video discusses moving either the default database or any database to a new volume.

827 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