Applies to: Exchange Server 2010 SP3, Exchange Server 2010 SP2

Topic Last Modified: 2012-11-15

Use the Remove-StoreMailbox cmdlet to purge the mailbox and all of its message content from the mailbox database. This results in permanent data loss for the mailbox being purged. You can only run this cmdlet against disconnected or soft-deleted mailboxes. Running this command against an active mailbox fails, and you receive an error.

Syntax

Remove-StoreMailbox -Database <DatabaseIdParameter> -Identity <StoreMailboxIdParameter> -MailboxState <Disabled | SoftDeleted> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]

Detailed Description

When mailboxes are moved from a Microsoft Exchange Server 2010 Service Pack 1 (SP1) database to any other database, Exchange doesn't fully delete the mailbox from the source database immediately upon completion of the move. Instead, the mailbox in the source mailbox database is switched to a soft-deleted state, which allows mailbox data to be accessed during a mailbox restore operation by using the new MailboxRestoreRequest cmdlet set. The soft-deleted mailboxes are retained in the source database until the deleted mailbox retention period expires.

To view soft-deleted mailboxes, run the Get-MailboxStatistics cmdlet against a database using the property DisconnectReason with a value of SoftDeleted.

A mailbox is marked as Disabled immediately after the Disable-Mailbox or Remove-Mailbox command completes. Exchange retains disabled mailboxes in the mailbox database based on the deleted mailbox retention settings configured for that mailbox database. After the specified period of time, the mailbox is permanently deleted.

To view disabled mailboxes, run the Get-MailboxStatistics cmdlet against a database using the property DisconnectReason with a value of Disabled.

You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Remove Store Mailbox" entry in the Mailbox Permissions topic.

Parameters

Parameter Required Type Description

Database

Required

Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter

The Database parameter specifies the identity of the mailbox database on which the mailbox that you want to remove resides. This parameter accepts the following values:

  • Database name

  • GUID

Identity

Required

Microsoft.Exchange.Configuration.Tasks.StoreMailboxIdParameter

The Identity parameter specifies the identity of the mailbox that you want to remove. This parameter accepts the following values:

  • GUID

  • Distinguished name (DN)

  • User principal name (UPN)

  • LegacyExchangeDN

  • Domain\Account Name

  • SMTP address

MailboxState

Required

Microsoft.Exchange.Management.StoreTasks.MailboxStateParameter

The MailboxState parameter specifies the mailbox state on the source mailbox database. This parameter accepts the following values:

  • Disabled

  • SoftDeleted

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm switch can be used to suppress the confirmation prompt that appears by default when this cmdlet is run. To suppress the confirmation prompt, use the syntax -Confirm:$False. You must include a colon ( : ) in the syntax.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf switch instructs the command to simulate the actions that it would take on the object. By using the WhatIf switch, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf switch.

Input Types

To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn’t accept input data.

Return Types

To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn’t return data.

Examples

EXAMPLE 1

This example purges the soft-deleted mailbox for Ayla Kol from mailbox database MBD01.

Copy Code
Remove-StoreMailbox -Database MBD01 -Identity Ayla -MailboxState SoftDeleted

EXAMPLE 2

This example permanently purges the disconnected mailbox with the GUID 2ab32ce3-fae1-4402-9489-c67e3ae173d3 from mailbox database MBD01.

Copy Code
Remove-StoreMailbox -Database MBD01 -Identity "2ab32ce3-fae1-4402-9489-c67e3ae173d3" -MailboxState Disabled

EXAMPLE 3

This example permanently purges all soft-deleted mailboxes from mailbox database MBD01.

Copy Code
Get-MailboxStatistics -Database MBD01 | where {$_.DisconnectReason -eq "SoftDeleted"} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}