Monday, August 22, 2011

Get the Mailbox Size for a list of users in Exchange 2010

In the previous blog "Get Mailbox Size for an account in Exchange 2010", we talked on how to get the mailbox size for 1 user using the Microsoft Exchange Shell of Exchange 2010.
Now, we will explain how to get the mailbox size for a list of users.

It is very simple, Have the list of users sorted by line in a text file.
An example of the text file ITDepartment.txt file:

ITServices Montreal
Networking Montreal
Exchange2010 Montreal

where "ITServices Montreal"is the display name of the user. You can also use the email address, or the user principal name instead of the display name.We will the place the ITDepartment.txt file in the C:\Scripts folder.

What we need to do first is to get the list of the users inside this text file:
Try the command:
Get-Content "C:\Scripts\ITDepartment.txt"

The result will be:
[PS] C:\windows\system32>Get-Content "C:\scripts\ITDepartment.txt"
ITServices Montreal
Networking Montreal
Exchange2010 Montreal

[PS] C:\windows\system32>

Now for each line resulted from the Get-Content command, we need to run the MailboxStatistics, so we use the "|"

Now try the whole command:

[PS] C:\windows\system32>Get-Content "C:\Scripts\ITDepartment.txt" | Get-MailboxStatistics | Format-List -property displayName, TotalItemSize



DisplayName : ITServices Montreal
TotalItemSize : 61.18 MB (64,155,174 bytes)

DisplayName : Networking Montreal
TotalItemSize : 163 MB (170,937,036 bytes)

DisplayName : Exchange2010 Montreal
TotalItemSize : 25.03 MB (26,243,124 bytes)

[PS] C:\windows\system32>

I invite you to read another blog about recruitment and how to find a job
 http://findonejob.blogspot.ca/

I hope this blog was helpful, and I would like to thank you for reading.

Get Mailbox Size for an account in Exchange 2010

Let's say we need to get the Mailbox Size of the user: ITServices

[PS] C:\Windows\system32>Get-MailboxStatistics -Identity ITServices  | Format-List -property displayName, TotalItemSize

DisplayName   : ITServices
TotalItemSize : 26.32 MB (27,601,859 bytes)

So In order to get the mailbox size
, you have to get the MailboxStatistics, but if you use only the command: Get-MailboxStatistics -Identity ITServices , you will not get the mailbox size, you will get the ITemCount and the storageLimitStatus


DisplayName               ItemCount      StorageLimitStatus       LastLogonTime
-----------                   ---------         ------------------        -------------
ITServices User           1792              BelowLimit                  22/08/2011 5:57:29 PM

To show all values of the Mailbox you need to use the command:
Get-MailboxStatistics -Identity ITServices | Format-List

If you need to show only the display name and the size value, then you must specify to show the properties "displayName" and "totatItemSize" only:

Get-MailboxStatistics -Identity   ITServices  | Format-List -property displayName, TotalItemSize


If you are looking or a System admninistrator position, create a profile in the recruitment website below:
http://www.security-architecture.com/

 I hope this was helpful, and I would like to thank you for reading.