Solved

PowerShell - Exchange - Mailbox Size

Posted on 2011-03-03
6
2,011 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:SatyaPathak
ID: 35028568
0
 
LVL 20

Expert Comment

by:SatyaPathak
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

759 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

18 Experts available now in Live!

Get 1:1 Help Now