#PSTip How to find which mailboxes are over quota limits

Note: This tip requires PowerShell 2.0 or above.

In a previous tip we saw how to configure storage quotas for a mailbox using PowerShell. Today we will see how we can find all mailboxes that are over quota or received a quota message. Let’s check the quota status for a given mailbox. Open the Exchange Management Console (EMC) and type the following commands:

PS> $stats = Get-Mailbox user1 | Get-MailboxStatistics
PS> $stats.StorageLimitStatus

You can see that the quota limit has not been reached and that the mailbox capacity is below the limit. StorageLimitStatus is a System.Enum object that holds several values:

PS> $stats.StorageLimitStatus.GetType().FullName

PS> [enum]::GetNames('Microsoft.Exchange.Data.Mapi.StorageLimitStatus')

We can check the status of all mailboxes on a given database:

PS> Get-Mailbox -Database db1 | Get-MailboxStatistics | Select-Object DisplayName,StorageLimitStatus
DisplayName         StorageLimitStatus
-----------         ------------------
User1                       BelowLimit
User2                     IssueWarning
User3                       BelowLimit

Or for all mailboxes. You may want to refine the search to return just the mailboxes with a specified StorageLimitStatus value (over quota).

PS> Get-MailboxDatabase | Get-MailboxStatistics | Where-Object {$_.StorageLimitStatus -match 'IssueWarning|ProhibitSend|MailboxDisabled'}

DisplayName       ItemCount StorageLimitStatus        LastLogonTime
-----------       --------- ------------------        -------------
User2             2400            IssueWarning
User4             5010            IssueWarning 9/8/2013 10:04:20 AM
User5             2956            IssueWarning 9/8/2013 10:03:46 AM
User6             2316         MailboxDisabled  9/8/2013 9:53:11 AM
User7             4433            ProhibitSend

Note: To check the status of archive mailboxes, add the –Archive switch to the Get-Mailbox command.

Share on:
comments powered by Disqus