Delete bulk messages by Subject thru Exchange 2010 command shell

This is very useful to delete multiple messages on a large mailbox by subject without logging into the mailbox.

Before you can delete message you have to make sure the administrator has proper access.

First you have to add your administrator to the Discovery Management role group

Add-RoleGroupMember -Identity “Discovery Management” -Member Administrator

Then you have to make sure your Administrator is apart of the Mailbox Import Export role The easiest way to add that is by following these steps

Open up your Exchange Management Console Go to Toolbox and open up Role Based Access Control Login and double click “Organization Management Add “Mailbox Import Role” Also check to make sure Administrator is a user in that account.

Restart your Exchange Management Shell and now you can use the following command to delete your messages

Search-Mailbox -Identity “April Stewart” -SearchQuery ‘Subject:”Your bank statement”‘ -DeleteContent -force

Mark as helpful.

Posted in: Exchange, Server