Sometimes you need to remove a special email from ALL mailboxes on your exchange server. This is quite easy via the powershell.
At first, make sure that the account running the powershell command has the appropriate permissions. If you don’t have the correct permissions you will get an error “The term ‘xxxxxxxxx’ is not recognized as the name of a cmdlet”.
To delete a mail just run a modified statement as the following:
Get-Mailbox -Server yourexchangeserver01 | Search-Mailbox -SearchQuery 'Subject:"New sales offer"' -deletecontent
Get-Mailbox -Server yourexchangeserver01 | Search-Mailbox -SearchQuery 'email@example.com' -deletecontent
If that works you see some output as:
RunspaceId : 024a0341-3daa-2b49-aac1-fed906816ed4
Identity : adminenclave.local/FR/Agents/Joe Blocks
Success : True
ResultItemsCount : 0
ResultItemsSize : 0 B (0 bytes)