Monday, 13 July 2015

Delete specific message from all mailboxes on Exchange 2010 server


Microsoft Windows 2008R2 with Exchange 2010 SP1


You have been asked to delete message with subject "Confidential" from all mailboxes in the organization.


1. Assign your account the "Mailbox Import Export RBAC" role.
Start  "Exchange Management Shell" and use below command:
New-ManagementRoleAssignment -Role "Mailbox Import Export" -User administrator
2. Close and Reopen "Exchange Mangement Shell" to apply changes.
3. Create report before deleting actual data.

Summary report send to administrator's mailbox
Get-mailbox | Search-Mailbox –SearchQuery "Subject:'Confidential'" –Logonly –Targetmailbox administrator –Targetfolder Inbox
You can also use additional switches like:
-LogLevel Full
You can also export report to a csv file:
Get-Mailbox | Search-Mailbox -SearchQuery "Subject:'Confidential'" -EstimateResultOnly | Export-CSV C:\email-report.csv -NoType
4. Now delete all emails
Get-mailbox | Search-Mailbox –SearchQuery "Subject:'Confidential'" –DeleteContent

Source: 1 2 3 4

No comments:

Post a Comment