Remove a email for Exchange Online user

AXISHK used Ask the Experts™
A particular email need to delete from all my Exchange Online User. Any idea how to do this ?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IvanSystem Engineer


here is the guide how to bulk remove email from accounts:

Apart from ComplianceSearch-related cmdlets, you can also use Search-Mailbox with the -Delete switch. Here is a detailed guide on how to perform a bulk-delete action:
How to delete email from mailboxes on Exchange 2016 / 2013 / 2010 / Online
The most important part is to correctly set the -SearchQuery, so that you target the particular email and do not delete anything else. If you use the -EstimateResultOnly switch instead of "-Delete", you will be able to see how many items are targeted.
FOXActive Directory/Exchange Engineer
Top Expert 2015

Connect to o365 via powershell

Do you have for example the subject line of the email?  The below one liner will delete it from all of your o365 users mailboxes

Get-Mailbox -ResultSize Unlimited | Search-mailbox -SearchQuery 'Subject:"Bad Email on Deck"' -DeleteContent


Subject with non English chars can't be searched successfully. Do I need to install anything on my workstation ?

search-mailbox -identity johnlee -searchquery "Subject:答复:  请帮忙开通付兵的邮箱" -EstimateResultOnly
The property keyword isn't supported.
    + CategoryInfo          : InvalidArgument: (:) [], ParserException
    + FullyQualifiedErrorId : AAAC573B
    + PSComputerName        :
The cmdlet most probably fails because of the second colon inside the query. You could try changing the query to:
-searchquery "Subject:'请帮忙开通付兵的邮箱'"

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial