Exchange 2010: Mailbox Size

This post demonstrates how you can use Exchange Powershell to list and export user mailbox size, including deleted items size.

Run the command below to generate a list of all users, what databse their mailbox is stored in, the TotalItemSize, and TotalDeletedItemSize (Storage space used in the recoverable items folder)

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus

To export these statistics to a CSV file, append | Export-CSV $strFileName to the end of the command.

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus | Export-CSV $strFileName

To sort the results in order of size, you can use the Sort-Object parameter

Get-MailBox | Get-MailboxStatistics | select DisplayName,DatabaseName,TotalItemSize,TotalDeletedItemSize,StorageLimitStatus | Sort-Object TotalItemSize -Descending

See Also:


Exchange 2010: Storage Quota Warnings are not Sending

In exchange 2010 SP1, users are not receiveing quota warning messages when they are beyond the Issue Warning threshold.

Microsoft have an article relating to this issue.
Users do not receive quota warning messages after you apply Service Pack 1 for Exchange Server 2010

To resolve this issue, follow these steps:

  1. Install the following update rollup package:
        2608646 Description of Update Rollup 6 for Exchange Server 2010 Service Pack 1

  2. After you install the update rollup package that is described in step 1, modify the registry. To do this, follow these steps:
        a.Click Start, click Run, type regedit, and then click OK.
        b. Locate and then click the following registry subkey:

        c. On the Edit menu, point to New, and then click DWORD Value.

        d. Type CheckWarningQuota, and then press Enter.

        e. Right-click CheckWarningQuota, and then click Modify.

        f. In the Value data box, type 1, and then click OK.

        g. Exit Registry Editor.

3.Restart the Microsoft Exchange Information Store service.


Exchange 2010: Set Work Hours for Room Mailbox

In Exchange 2010, when you create a room or resource mailbox, the Resource Policy tab gives you the option to Allow scheduling only during business hours. But what is business hours?

The default business hours is from 8:00 am until 5:00 pm. You can check this by running this PowerShell command

Get-MailboxCalendarConfiguration -Identity <mailboxidentity> | fl

Tp change the woprking hours for an individual resource, run the following command

Set-MailboxCalendarConfiguration -Identity <mailboxidentity> -WorkingHoursStartTime 
<start time in format 00:00:00> -WorkingHoursEndTime <end time in format 00:00:00>


Set-MailboxCalendarConfiguration -Identity room1-WorkingHoursStartTime 08:30:00 
-WorkingHoursEndTime 17:30:00

And if you want to change the settings for all room mailboxes:

Get-Mailbox | Where {$_.RecipientTypeDetails -eq "RoomMailbox"} | 
Set-MailboxCalendarConfiguration -WorkingHoursStartTime 08:30:00 -WorkingHoursEndTime 17:30:00

See also Manage resource work hours in Exchange Server 2007 and 2010

Exchange 2010: Remove disconnected mailbox

After you delete a user from Acrive directory or Exchagne their mailbox is kept in the Exchange database for a number of days until it is automatiaccly removed. As defined in the “Limits” section of the database properties.

If you want to force the removal of the disconnected mailbox to free up space within your mailbox database, you can do so with the following powershell functions.

Save the following as Disconnected-Mailboxes.ps1

function Get-DisconnectedMailbox {
        [Parameter(Position=0, Mandatory=$false)]
        $Name = '*'

    $mailboxes = Get-MailboxServer
    $mailboxes | %{
        $disconn = Get-Mailboxstatistics -Server $ | ?{ $_.DisconnectDate -ne $null }
        $disconn | ?{$_.displayname -like $Name} | sort -Property DisplayName |
            Select DisplayName,

function Remove-DisconnectedMailbox {
        [Parameter(Position=0, ValueFromPipelineByPropertyName=$true, Mandatory=$true)]
        [Parameter(Position=1, ValueFromPipelineByPropertyName=$true, Mandatory=$true)]
	[Parameter(Position=2, ValueFromPipelineByPropertyName=$true, Mandatory=$true)]

    process {
        Remove-StoreMailbox @PSBoundParameters

These two functions will list all the disconnected mailboxes, and delete disconnected mailboxes.

See Here to find out how to import functions into Power Shell

This function will list all the disconnected mailboxes

This function will remove a disconnected mailbox

To remove all disconnected mailboxes, run this command

Get-DisconnectedMailbox | Remove-DisconnectedMailbox

Exchange 2010: Send on Behalf of a Distribution Group

When trying to send an email on behalf of a distribution group email address, you may get the following error:

Your message did not reach some or all of the intended recipients.
      Subject:  <Subject>
      Sent:     7/06/2012 10:55 AM
The following recipient(s) cannot be reached:
      '<email>' on 7/06/2012 10:55 AM
            550 5.7.1 Client does not have permissions to send as this sender

To get around this, you will need to assign Send on Behalf of permissions on the distribution group.
You can assign either an individual user, or a group to send on behalf of the distribution group.

You can grant the send on behalf permission to all members of the same group, which can save on administrative effort over time if all group members should be allowed to send of behalf of the group they are in.

In Exchange Management Shell run the following command:

Set-DistributionGroup "Sales Team" -GrantSendOnBehalfTo "Sales Team"

See also This Post
To grant Send As permissions, check this post

Exchange 2010: Purge Dumpster

This article outlines how to force empty the deleted items / recoverable items dumpster in a users mailbox.

To view how much space is consumed by all users dumpster files run this command:

Get-MailBox | Get-MailboxStatistics | select DisplayName,TotalDeletedItemSize

To view an individuals TotalDeletedItemSize, run this command:

Get-MailboxStatistics <alias> | select DisplayName,TotalDeletedItemSize

To view how much white space / available space is in your database run this command:

Get-MailboxDatabase -Status | Sort-Object DatabaseSize -Descending | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace

The idea now is to forcefully delete the TotalDeletedItemSize to increase the AvailableNewMailboxSpace in your mailbox databases.

For this we will use the Search-Mailbox command with the -SearchDumpsterOnly-DeleteContent switch.
This will delete all dumpster items from the users mailbox, which means the user will not be able to retrieve these items form Recover Deleted Items in Outlook

Search-mailbox -identity <alias> -SearchDumpsterOnly -DeleteContent

Exchange 2010: The Term “Search-Mailbox” Is Not Recognized as the Name of a cmdlet

When using Powershell to run the Search-Mailbox command the following error is generated:

Search-Mailbox” Command in Powershell: The Term “Search-Mailbox” Is Not Recognized as the Name of a cmdlet

This error will be generated if the snap-in has not been registered. To register the snap-in use the following command:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010