In Exchange 2007 and 2010 the use with Clean-MailboxDatabase
cmdlet we get mailboxes visible in the GUI without having to wait
for the maintenance schedule.
in Exchange 2013 this cmdlet no longer exists but the same problem
persists: disconnected mailboxes are not visible immediately after being
removed /disabled "Clean-MailboxDatabase" has been replaced by Update-StoreMailboxState,
which forces the mailbox store state in the Exchange store to be synchronized
with Active Directory.
1.Disconnected mailboxes visible
In Exchange
2010>>
Clean-MailboxDatabase
-Identity <database
name>
Example:
clean-MailboxDatabase
-Identity db1
For all Databases – Get-MailboxDatabase | Clean-mailboxdatabase
in Exchange 2013>>
For Specific Database –
Get-MailboxStatistics -Database <DB name> | Where { $_.DisconnectReason -ne $null } |ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }
Example:
Get-MailboxStatistics -Database db1| Where { $_.DisconnectReason -ne $null } |ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false }
For all Databases –
Get-MailboxDatabase | foreach{Get-MailboxStatistics -Database $_.identity} | Where { $_.DisconnectReason -ne $null } | ForEach { Update-StoreMailboxState -Database $_.Database -Identity $_.MailboxGuid -Confirm:$false } -Verbose
2. Show Disconnected mailbox
Get-MailboxDatabase <DB name> | Get-MailboxStatistics | Where {($_.DisconnectDate -ne $null)} |fl
For Show Disconnected Archive Mailboxes –
Get-MailboxDatabase <DB Name> | Get-MailboxStatistics | Where {($_.DisconnectDate -ne $null) -and ($_.IsArchiveMailbox -eq $true)} |FL
3.Reconnect a Mailbox –
Connect-Mailbox -Identity < DisplayName/GUID> -User <AD user> -Database <DB name>
Reconnecting the Archive
Mailbox in Exchange 2013 –Connect-Mailbox -Identity < DisplayName/GUID> -Archive -User <AD user> -Database <DB Name>