Is there a way to remove a particular email from Exchange? I have over 200 users that received a spam email that i want to remove from their Outlook

Is there a powershell script or a way to remove an email from everyone by the sender's email address?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Waddah DahahCommented:
if you are using Exchange 2010 open Exchange PowerShell and execute following command;

get-mailbox | Search-Mailbox -SearchQuery ‘ ‘ -TargetMailbox “adminmailbox” -TargetFolder “DeleteVirus” -LogLevel Full –DeleteContent

CiscoAznAuthor Commented:
what is the adminmailbox? the target is everyone's mailbox and is the "DeleteVirus" a folder I need to create?
Guy LidbetterCommented:
The admin mailbox is whatever mailbox name you put in could be yours or a another persons. The target folder is the folder in which to put a copy of the deleted email in the admin mailbox specified... you don't need to do this... you could just -deletecontent but if the email hit is wrong you'd need a copy to put back!

The search query could also be the subject name - which is probably a better target...   i.e. -searchquery 'Subject:"Subject in here"'
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Waddah DahahCommented:
Excellent answer Guy!
Thank you.
CiscoAznAuthor Commented:
the question here is the source is everyone and not a specific mailbox like an adminmailbox. Just confused.
Guy LidbetterCommented:
OK... a better break down...

Get-Mailbox | Search-Mailbox "Get every single mailbox in organization (add "-resultsize unlimited" if you have more than 1000) - Then search them!!!"
-TargetMailbox  "A mailbox where you want a copy of the found emails to be sent" -Optional
-TargetFolder "Folder inside said mailbox - where you would like the found emails to be saved - you do not need to create this" -optional
-SearchQuery "what you are looking for"
-DeleteContent "Delete any found emails that match above query - it doesn't delete everything everywhere"
-Loglevel full "Tell me everything you find out about everything you find"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CiscoAznAuthor Commented:
Thanks guys!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.