• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1305
  • Last Modified:

Delete message from all mailboxes from Exchange Server 2007 by Messaage ID

I have done this in the past using exmerge, but I don't know the command to do it on Exchange 2007. Using the Exchnage Management Shell I know how to delete messges by subject or sender by using the get-mailbox command, for example Get-mailbox -database 'database' | export-mailbox -SubjectKeywords "Test" -DeleteContent. How is it done by Message ID? Sometimes the suject keywords are common and I don't want to remove all messages from a particular sender. For example,  a user sends out an inappropriate e-mail that says see attached in the subject line.

Thanks,
0
nlreinhold
Asked:
nlreinhold
  • 4
  • 2
1 Solution
 
shauncroucherCommented:
I don't believe you can specify by MessageID using export-mailbox, but is there content within the email body that is unique enough?

Is so, you could use -AllContentKeywords (for body and subject) or -contentkeywords for body only.

Shaun
0
 
Satya PathakLead Technical ConsultantCommented:
go through.

Get-mailbox -database 'DB1' | export-mailbox SubjectKeywords "Confidential" -TargetFolder "ConfidentialData" -TargetMailbox Administrator DeleteContent

More Info:
http://msexchangeteam.com/archive/2006/11/28/431669.aspx
http://msexchangeteam.com/archive/2006/12/18/431934.aspx
0
 
nlreinholdAuthor Commented:
shaucroucher: When using -AllContentKeyowords will it delete specific strings or all words within a string? For example: "A man got burnt while steeling copper", would also delete e-mails containing the following sentence. Steeling from the company is a criminal offense, or The price of copper is 2.53 a pound.
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
shauncroucherCommented:
It will delete the entire message. The -allcontentkeywords is just a way of identifying which ones to extract. It will find the exact phrase only, not any keyword. Use -whatif to see what it would do if you ran it, without taking action.

You could also export to one mailbox instead of delete to verify what has been exported.

Shaun
0
 
nlreinholdAuthor Commented:
Thanks shauncroucher, I like the what if part. I have exported to an administrator mailbox but with as many users I have across the organization it creates a lot of folders to look through to make sure it removed them. It maintains the directory structure of each user mailbox as a sufolder of "recovered".
0
 
shauncroucherCommented:
Glad I could help,

Shaun
0
 
shauncroucherCommented:
You might want to try adding -TargetFolder to see if that bunches all the items in one folder, I'm not sure if it does

Shaun
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now