Clean-MailboxDatabase (RTM)

Microsoft Exchange Server 2007 will reach end of support on April 11, 2017. To stay supported, you will need to upgrade. For more information, see Resources to help you upgrade your Office 2007 servers and clients.

 

Applies to: Exchange Server 2007

Use the Clean-MailboxDatabase cmdlet to scan the Active Directory directory service for disconnected mailboxes that are not yet marked as disconnected in the Microsoft Exchange store and update the status of those mailboxes in the Exchange store. This cmdlet is not able to update the Exchange store unless the Microsoft Exchange Information Store service is running and the database is mounted.

Syntax

clean-MailboxDatabase -Identity <DatabaseIdParameter> [-DomainController <Fqdn>]

Detailed Description

To run the Clean-MailboxDatabase cmdlet, the account you use must be delegated the Exchange Organization Administrator role.

For more information about permissions, delegating roles, and the rights that are required to administer Exchange Server 2007, see Permission Considerations.

A connected mailbox has two parts: the mailbox object in the Exchange store, and the user object with Exchange properties in Active Directory. A disconnected mailbox is the mailbox object in the Exchange store, but it is not connected to a user object in Active Directory. To disconnect a mailbox, use the Disable-Mailbox cmdlet. To disconnect a mailbox and remove the user object from Active Directory, use the Remove-Mailbox cmdlet.

If you want to reconnect a disconnected mailbox to an Active Directory user account, use the Connect-Mailbox cmdlet.

If you want to permanently remove a mailbox object from the Exchange store, use the Remove-Mailbox cmdlet.

Under normal circumstances, it is not necessary to run Clean-MailboxDatabase because a mailbox is marked as disconnected immediately after the Disable-Mailbox or Remove-Mailbox command completes. If you used the Disable-Mailbox cmdlet or the Remove-Mailbox cmdlet while the Exchange Information Store service was stopped, or if a mailbox was disabled by an external means other than the Disable-Mailbox cmdlet or Remove-Mailbox cmdlet, you may want to use the Clean-MailboxDatabase cmdlet to scan for disconnected mailboxes.

Note

You can run the Clean-MailboxDatabase cmdlet in Microsoft Exchange Server 2007 to achieve the same results as the Run Cleanup Agent action in the Exchange Server 2003 System Manager. To run the cleanup agent, in Exchange System Manager, expand Servers, expand the server name, expand the storage group name, expand the mailbox database name, right-click Mailboxes, and select Run Cleanup Agent.

For more information, see the following topics:

Parameters

Parameter Required Type Description

Identity

Required

Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter

The Identity parameter identifies the mailbox database that you want to update. You can use the following values:

  • GUID

  • Distinguished name (DN)

  • Name of the mailbox database

  • Server name\storage group name\database name

  • Server name\database name

  • Storage group name\database name

If you do not specify the server name, the command will search for the database on the local server. If you have multiple databases with the same name, you must specify the storage group.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

To specify the fully qualified domain name (FQDN) of the domain controller that retrieves data from Active Directory, include the DomainController parameter in the command.

Input Types

Return Types

Errors

Error Description

 

Exceptions

Exceptions Description

 

Example

The following example shows how to clean the mailbox database named MyMailboxDatabase.

Clean-MailboxDatabase MyMailboxDatabase