PowerShell – Disconnected mailboxes are not yet marked as disconnected

Use the Clean-MailboxDatabase cmdlet to scan the Active Directory directory service for disconnected mailboxes that are not yet marked as disconnected in the Microsoft Exchange store and update the status of those mailboxes in the Exchange store.
This cmdlet is not able to update the Exchange store unless the Microsoft Exchange Information Store service is running and the database is mounted.

Run from exchange management shell:

$mailboxDatabase = Get-MailboxDatabase

foreach ($cont in $mailboxDatabase){
	clean-MailboxDatabase -Identity $cont.Name
}

From remote or normal Powershell window:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
	$mailboxDatabase = Get-MailboxDatabase	
	foreach ($cont in $mailboxDatabase){
		clean-MailboxDatabase -Identity $cont.Name
	}
Remove-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

-Pouyan

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.