How to remove (purge) Disconnected Mailboxes

How to remove (purge) Disconnected Mailboxes

This post is also available in: Polish

If in the Microsoft Exchange Server 2010 we delete mailbox users by selecting the Remove or Disable, mailboxes and their contents are still stored in the Exchange database.

The difference between the operation Remove and Disable:

  • Disable – disconnects the mailbox from email were the user account in Active Directory, leaving the user account enabled, as indicated in the Disconnected mailboxes list, disappears from the address book and it can be reconnected by going in for EMC: Exchange Organization -> Recipient Configuration -> Disconnect Mailboxes
  • Remove – removes the user account in Active Directory with mailbox

If you want to see a list of disconnected mailboxes in specified Exchange databasethen use the command:

Get-MailboxStatistics -Database "MailboxDatabase" | Where { $_.DisconnectDate -ne $null } | select DisplayName, DisconnectDate,TotalItemSize, TotalDeletedItemSize

to show all disconnected mailboxes in specified mailbox server:

Get-MailboxStatistics -Server MBXServer | where { $_.DisconnectDate -ne $null } | select DisplayName,DisconnectDate | sort DisconnectDate

After removing the mailbox (Disable), the mailbox does not appear immediately in Disconnected Mailboxes List. It was only after the utility for database Maintence Exchange mailbox will be marked as disconnected and can be found in Disconnected Mailboxes. Same mailbox, however, remain in the database in which there were prior to termination.

Mailboxes in such a state will be stored in the database for 30 days (the default) unless it is changed for a database parameter for how long after removal of mailboxes to be permanently removed.

To speed up the appearance of mailboxes in Disconnected Mailboxes after it is disconnected we can do:

Get-MailboxDatabase | Clean-MailboxDatabase

 

The difference between Disabled mailboxes and Soft-Deleted mailboxes:

Disabled mailboxes - this state is caused by an operation Disable or Remove the active boxes. These mailboxes are stored in a database where they were until the expiry of the retention time for deleted mailboxes. After this time the mailbox will be completely removed and will be released in the database. MailBoxes in this state are not displayed in the address book.

Soft-Deleted mailboxes – arise from moving mailboxes between databases. After the mailbox is moved to a new database in orginal mailbox base is not removed, but switched to soft-deleted state. In such a case will remain in the original database until the expiry of the retention time for deleted mailboxes. To force the removal of such boxes must use the command Remove-Storemailbox.

To see all mailboxes in the database that are Disabled do:

Get-MailboxStatistics –Database “MBXDatabase″ | Where-Object {$_.DisconnectReason –eq “Disabled”}

to remove all disabled mailboxes in database:

$Mailboxes = Get-MailboxStatistics -Database “MBXDatabase″ | where {$_.DisconnectReason -eq “Disabled”}
$Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState Disabled -Confirm:$False}

to remove Soft-Deleted mailboxes in database:

$Mailboxes = Get-MailboxStatistics -Database “MBXDatabase″ | where {$_.DisconnectReason -eq “SoftDeleted”}
$Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted -Confirm:$False}

 

第二种:

How to remove disconnected mailboxes in Exchange Server 2010

05 Jan
 

How to remove disconnected mailboxes in Exchange Server 2010

Steps to remove single disconnected mailbox from Exchange 2010:

1. Make active directory replication is completed after deleted the mailbox.
2. Go to Exchange Management Shell
3. Run the following command to get the updated mailbox information from active directory.

Get-MailboxDatabase | Clean-MailboxDatabase

4.Run the following command to get the all the Mailboxes from a Exchange 2010 Mailbox database. Disconnected mailbox will have "DisconnectedDate" , But Normal mailboxes Disconnected date will be empty.

Get-MailboxStatistics -Database "E14 Mailbox DB Name" | FL DisplayName, DisconnectDate, MailboxGuid

5. From the output, Copy the MailboxGuid Value for the Disconnected Mailbox that we want to remove.
6. Execute the following command to Remove the disconnected mailbox from Exchange 2010 completely.

Remove-Mailbox -Database "E14 Mailbox DB Name" -StoreMailboxIdentity "MailboxGuid" -Confirm:$False

Steps to remove all disconnected mailbox from Exchange 2010:

1. Make active directory replication is completed after deleted the mailbox.
2. Go to Exchange Management Shell
3. Run the following command to get the updated mailbox information from active directory.

Get-MailboxDatabase | Clean-MailboxDatabase

4.Run the following command to get the all the Mailboxes from a Exchange 2010 Mailbox database. Disconnected mailbox will have "DisconnectedDate" , But Normal mailboxes Disconnected date will be empty.

Get-MailboxStatistics -Database "E14 Mailbox DB Name" | FL DisplayName, DisconnectDate, MailboxGuid

5. Execute the following command to remove all disconnected mailbox from Exchange 2010 completely.

Get-MailboxStatistics | Where { $_.DisconnectDate -ne $null } | Remove-Mailbox -Database "E14 Mailbox DB Name" -StoreMailboxIdentity $_.MailboxGuid -Confirm:$false

[OR]

$Users = Get-MailboxStatistics | Where { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid

$Users | ForEach { Remove-Mailbox -Database "E14 Mailbox DB Name" -StoreMailboxIdentity $_.MailboxGuid -Confirm:$false }

 

http://msexchangehelp.wordpress.com/2010/03/03/how-to-remove-disconnected-mailboxes-in-exchange-server-2010/#comment-125 

以上解决方法抄自:

http://msexchangehelp.wordpress.com/2010/03/03/how-to-remove-disconnected-mailboxes-in-exchange-server-2010/

在实际使用时发现批量删除的方法原作者做的不是很好。我使用的方法如下:

$Users = Get-MailboxStatistics -database"E14 Mailbox DB Name" | Where { $_.DisconnectDate -ne $null } |Select DisplayName,MailboxGuid
原作者在上面这个命令中未带参数-database,会出现错误!
$Users | ForEach { Remove-Mailbox -Database"E14 Mailbox DB Name" -StoreMailboxIdentity $_.MailboxGuid-Confirm:$false }

第三种:

Delete a disconnected mailbox from exchange 2010

05 Jan

Delete a disconnected mailbox from exchange 2010

 

easy command in the Exchange Management Shell

clean-mailboxdatabase “Mailbox Database 1166050598″

However you should get all information about the mailbox of the deleted user and disconnected mailbox. To get this information you should use the Exchange Management Shell. You can use the following command..

Get-MailboxStatistics -Database “Mailbox Database 1166050598″ | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid

Result

DisplayName    : USERName
DisconnectDate : 1-8-2010 18:00:48
MailboxGuid    : def4aabd-2156-5857-858f-470efc3e6f28

Thake the MailboxGuid and copy it to Notepad. For easy modification.

This MailboxGuid is needed to remove the mailbox completely.

Remove-Mailbox -Database “Mailbox Database 1166050598″ -StoreMailboxIdentity def4aabd-2156-5857-858f-470efc3e6f28

After this command the mailbox is defiantly gone from your Exchange server.

[ exchange management console
> Microsoft Exchange On-Premises
> Recipient Configuration
> Disconnected Mailbox ]

with more disconnect mailboxes you could write a batch file for removing.

Exchange 2010 - Remove disconnected archive mailbox

Question:I am playing with Exchange 2010 personal archive feature. I have successfully tested following:

Enabled archive for one user, move a few emails into it. Then disabled archive. Enabled/Disabled archive for the same user again. Then I was able to re-connect the user back to the original archive mailbox with the messages inside.

Then I got problem to remove the disconnected archive mailboxes from Exchange.

Tried to remove the mailbox with command: remove-mailbox -Identity MAILBOXGUID -database -Permanent $true

Got error:

The operation couldn't be performed because object 'MAILBOXGUID' couldn't be found on 'exchangeServer.domain.local'

I double checked the GUID it is correct, somehow Exchange cannot resolve it...

answer:

Silly me...

To unhide the disconnected mailbox, simply run:

clean-mailboxdatabase "Mailbox Database 112123414"

Then you will be able to remove it with remove-mailbox command.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值