Clean-MailboxDatabase in Exchange2010 and Update-StoreMailboxState in Exchange 2013

      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>>

For Specific Database –
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>

 

OWA Show Error "Rights management operation failed." in exchange server 2010


When they try to open an e-mail with outlook web access. They get the following error message "Rights management operation failed."

 

Solution:

1. Log on to the exchange server and open (as Administrator) the Exchange Management Shell (EMS) 
 
2. Run "Get-OWAVirtualDirectory | FL" and search for IRM; you'll probably see that it's enabled.

3. Run "Set-OWAVirtualDirectory -IRMEnabled $false"
 
or you could provide the name of the identity using the -Identity "<identity goes here>"

for example:


4.  reset IIS  and try OWA again.