Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 88
  • Last Modified:


is there any command lets in exchange 2007  I can check to find below

How many mailboxes are greater than 2Gb in size? and export in csv file

Get-MailboxStatistics -Server RED-MSG01 | Where {$_.TotalItemSize -gt 2GB} | `
   Sort-Object -Property TotalItemSize -Descending | Format-Table DisplayName,TotalItemSize | Export-CSV "C:\AllMailboxes.csv"

will above work
1 Solution
Get-MailboxStatistics | Sort-Object TotalItemSize -Descending| ft DisplayName,@{label=”TotalItemSize(MB)”;expression={$_.TotalItemSize.Value.ToMB()}},ItemCount,StorageLimitStatus | Where {$_.TotalItemSize -gt 2GB}
pramod1Author Commented:
I wrote above command , how can I output in csv file, I just need numbers
Michael MachieFull-time technical multi-taskerCommented:
| out-file c:\ps-results\result.csv

Edit your save location and filename to fit your need.
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

pramod1Author Commented:
users are in 3gig group which is AD group , how can run a command to get the count
Todd NelsonSystems EngineerCommented:
Despite giving "out-file" a CSV extension it does not output a CSV formatted file. If you want a CSV formatted file you need to use "export-csv".

Therefore, the command you will need is more like this...

Get-MailboxStatistics | Sort-Object TotalItemSize -Descending| Select-Object DisplayName,@{label=”TotalItemSize(MB)”;expression={$_.TotalItemSize.Value.ToMB()}},ItemCount,StorageLimitStatus | Where {$_.TotalItemSize -gt 2GB} | export-csv c:\mailstats.csv -notype
@pramod1, Only change you need to make in your code is to change Format-Table to Select-object

Get-MailboxStatistics -Server RED-MSG01 | Where {$_.TotalItemSize -gt 2GB} | Sort-Object -Property TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize | Export-CSV "C:\AllMailboxes.csv" -nti

Open in new window

If you just need to view the count of users whose mailbox is greater than 2 G
(Get-MailboxStatistics -Server RED-MSG01 | Where {$_.TotalItemSize -gt 2GB} | Measure).Count

Open in new window

PS : Above commands will give mailboxes on servers RED-MSG01, if you have multiple servers on your environment..
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Where {$_.TotalItemSize -gt 2GB} | Sort-Object -Property TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize | Export-CSV "C:\AllMailboxes.csv" -nti

Open in new window


Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now