The Exchange 2007 Wiki

Remove- Mailbox

MSFT Synopsis:

Use the Remove-Mailbox cmdlet to remove the user account that is associated with a particular mailbox in the Active Directory directory service and to process the associated, disconnected mailbox as directed by the specified parameters.

When to Use:
  1. To remove the user account from AD and disconnect the Mailbox.
  2. To remove the user account and Purge the Mailbox from the store at the same time.
  3. For purging disconnected mailboxes from the database prior to the end of the retention time.
Gotchas:
  • Remove-Mailbox against an existing user object WILL remove the USER OBJECT.  This functionality is by design. Use [Disable-Mailbox] if you want to disconnect the mailbox from the user and leave the user object in place.
Role:

This command applies to the following Exchange Roles.

[Mailbox]

Permissions:

The following permissions are required when you run this command.

[Exchange Windows Administrators Group]
[Local Administrators]

Examples:
MSFT:

Description: Removes a given user from AD and disconnects their Mailbox
Comamnd: Remove-Mailbox -Identity contoso\john
  
Description: Removes a given user from AD and purges their mailbox from the database
Command:  Remove-Mailbox -Identity contoso\john -Permanent $true
  
Description:Purges from the database a single already disconnected mailbox.  Uses Get-MailboxStatistics to get the identity of the user before passing to remove-mailbox
Command: $Temp = Get-MailboxStatistics | Where {$_.DisplayName -eq 'John Peoples'}
Remove-mailbox -Database Server01\Database01 -StoreMailboxIdentity $Temp.MailboxGuid 

Addtional:
Description:Removes all disconnected Mailboxes from a Database 
Command: Get-MailboxStatistics -database "server\database" | where {$_.disconnectdate -ne $null} | foreach {Remove-mailbox -database $_.database -storemailboxidentity $_.mailboxguid}
 
Links:
Technet Information:
http://www.microsoft.com/technet/prodtechnol/exchange/e2k7help/0477708c-768c-4040-bad2-8f980606fcf4.mspx?mfr=true

Site

Changes
Index
Search

 

User

 

Log In
Register

 
 

Last Modified 1/25/07 10:49 AM