Blogs about my Technical experience and Activities (I am also maintaining my blog on wordpress http://khurramullah.wordpress.com)
Tuesday, November 11, 2008
MOSS RSS Feed Reader
Sunday, November 2, 2008
Removing Disconnected Mailboxes in Exchange 2007
Whenever we disable ore remove any mailbox, by default it goes in disconnected state and can be viewed in disconnected mailboxes view in EMC.
For disabling any account you can run following command
Disable-mailbox user@domain.com
You can also remove any account without providing confirm parameter. Confirm parameter will permanently delete the account and this account will not be visible in disconnected mailboxes view
Remove-Mailbox -Database <Database-Name>
If your account is not visible in disconnected mailboxes view you can confirm it by running following command
Clean-mailboxdatabase -identity "<server name>\<storage group name>\<mailbox database name>"
If you want to permanently delete your account then you have to run this command
Remove-Mailbox -Database <Database-Name> -StoreMailboxIdentity <MailboxGuid> -confirm:$false
For finding GUID you have to run this command
Get-MailboxStatistics -server <server name> | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
You have to copy the GUID and then paste in the above command for permanently deleting any account
If you want to remove all disconnected mailboxes then you have to first run following command
$users = Get-MailboxStatistics | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid
Now you have all users in Variable users, you can run following command
$users | ForEach { Remove-Mailbox -Database "Mailbox Database" -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }