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