Solved

exchange 2007 mailbox size

Posted on 2011-09-02
5
584 Views
Last Modified: 2012-05-12
Hi,
I am trying to get a report that will list all the mailboxes that are less than 10 GB.  I've used the following command but is gives me a lot of information that I do not need and it lists them by Byte size not GB.

get-mailbox |get-mailboxstatistics | export-csv test.csv| sort-object totalitemsize -descending |ft DisplayName,@{label="TotalItemSize(MB)";expression={$_.TotalItemSize.Value.ToMB()}},ItemCount

0
Comment
Question by:annayeg
[X]
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
5 Comments
 
LVL 23

Expert Comment

by:Suliman Abu Kharroub
ID: 36476764
You ccan use this :

Get-MailboxStatistics | export-csv test.csv | where {$_.ObjectClass -eq "Mailbox"} | Sort-Object TotalItemSize -Descending | ft DisplayName,TotalItemSiza,ItemCount,StorageLimitStatus

and arrange them using excel  to remove mailboxes larger then 10 GB
0
 
LVL 4

Expert Comment

by:ontech
ID: 36477643
I agree with Suliman.

For more details on powershell commands
Go get it at http://go.microsoft.com/?linkid=5719336
0
 
LVL 49

Accepted Solution

by:
Akhater earned 500 total points
ID: 36477651
the below code will do what you want and will show the output in GB

in the line "$mbxSize -lt 10" replace the 10 by any number if you want another threshold in GB


$mbxs = get-mailbox -resultsize unlimited

$all = @()

foreach ($mbx in $mbxs){

  
  $mbxStat = get-MailboxStatistics -identity $mbx

  $mbxSize = $mbxStat.TotalItemSize.Value.toGB()
       
  if ($mbxSize -lt 10){
     
     $out = new-object psobject 

     $out | add-member noteproperty Identity $mbx.name
     $out | add-member noteproperty Database $mbx.database
     $out | add-member noteproperty MailboxSize $mbxSize

     $all += $out
   }

   
   
} 

$all = $all | Sort-Object MailboxSize -Descending

$all | export-csv c:\list.csv

Open in new window

0
 
LVL 1

Author Comment

by:annayeg
ID: 36490475
Hi guys,

I tried pasting the above code in a notepad and rename it mailboxsize.ps2, but when I run it from EMS it opens up the code.
Is there anything that I need to paste in the script?

Thanks
0
 
LVL 49

Expert Comment

by:Akhater
ID: 36491433
it should be .ps1 and not .ps2
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
In this video we show how to create an Address List 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 Organization >> Ad…

688 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