When mailboxes are moved from Exchange 2010 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. Mailboxes data can be accessed during a mailbox restore operation using the MailboxRestoreRequest cmdlet set. The soft-deleted mailboxes are retained in the source database until either the deleted mailbox retention period expires or you use the Remove-StoreMailbox cmdlet to purge the mailbox. I’ve documented the removal procedure below.
1. Update the databases to show all disconnected mailboxes
Get-MailboxDatabase | Clean-MailboxDatabase
2. List all disconnected mailboxes and display Disconnect Reason if it’s Soft Deleted
Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -eq “SoftDeleted”} | Select DisplayName,Database,ItemCount,TotalItemSize
List all disconnected mailboxes in a database and display DisconnectReason if its SoftDeleted or Disabled
Get-MailboxStatistics -Database “mydatabase” | Where-Object {$_.DisconnectDate -Notlike $NULL} | Format-Table DisplayName, DisconnectDate, MailboxGuid, DisconnectReason –Wrap
EX:
Get-MailboxStatistics -Database DB1 | Where-Object {$_.DisconnectDate -Notlike $NULL} | Format-Table DisplayName, DisconnectDate, MailboxGuid, DisconnectReason –Wrap
3. Remove all SoftDeleted disconnected mailboxes from a Database
$Mailboxes = Get-MailboxStatistics -Database DB1 | where {$_.DisconnectReason -eq “SoftDeleted”}
$Mailboxes | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}
#Remove all Disabled disconnected mailboxes from a Database
$Mailboxes = Get-MailboxStatistics –Database “DB1 | Where-Object {$_.DisconnectReason –eq “Disabled”}
$Mailboxes | ForEach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState Disabled}
When mail box move from one database to another mail box server and different database, mail box showing disconnected state and mail box is not able to connect.
Check and run below mention command twice or thrice clean state twice or
[PS] C:\Windows\system32>Get-MailboxDatabase | Clean-MailboxDatabase
[PS] C:\Windows\system32>Get-MailboxDatabase | Clean-MailboxDatabase
[PS] C:\Windows\system32>Get-MailboxDatabase | Clean-MailboxDatabase
[PS] C:\Windows\system32>Get-Mailbox "hradmin" | Disable-Mailbox
Confirmed
Are you sure you want to perform this action?
Disabling mailbox "eragroup.in/ERAGROUP AD STRUCTURE NEW/SECURITY GROUP/BACKUP/New Backup/Ext Int Hr and Admin" will remove the Exchange properties from the
Active Directory user object and mark the mailbox in the database for removal. If the mailbox has an archive or remote archive, the archive will also be marked
for removal. In the case of remote archives, this action is permanent. You can't reconnect this user to the remote archive again.
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): a
And try to connect from exchange management console. The disconnected mail box will connected from disabled mail box.
Note:
By default, Exchange 2010 keeps disconnected mailbox’s in the DB for 14 days. But say you want to remove this mailbox now and return it’s white space to use in the DB. You need to remove the mailbox from the shell.
No comments:
Post a Comment