Avatar of AXISHK
AXISHK
 asked on

Remove a email for Exchange Online user

A particular email need to delete from all my Exchange Online User. Any idea how to do this ?

Thx
Exchange

Avatar of undefined
Last Comment
Adam the 32-bit Aardvark

8/22/2022 - Mon
Ivan

Hi,

here is the guide how to bulk remove email from accounts: https://docs.microsoft.com/en-us/office365/securitycompliance/search-for-and-delete-messages-in-your-organization

Regards,
Ivan.
Adam the 32-bit Aardvark

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.
FOX

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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
AXISHK

ASKER
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        : mecmail1.mongolia-energy.com
Thx
ASKER CERTIFIED SOLUTION
Adam the 32-bit Aardvark

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question