Exchange Email Clean

Hi All,
    Our client has sold a part of the business and now need to extract private business email from related accounts before handing over PST files. for example:

Email account:
Remove email from the following addresses:
Email Address:
Email Address:
Email Address:

We need to ensure that no information (or as little as possible) from the other internal sectors are not passed over to the new company.

We are using Exchange 2010 at the moment.

Who is Participating?
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.

AmitIT ArchitectCommented:
You can use search-mailbox command. Refer:

Check the example and customize it as per your requirement.
Jason CrawfordTransport NinjaCommented:
You can use Search-Mailbox as Amit suggested; however, your options with this method are to either copy the email found during the search to a separate mailbox or delete them.  If you decide to use Search-Mailbox, I think your best bet will be to do something like this (using the example):

1. Export the mailbox to a .pst file and save as a backup
2. Run the following command to optionally estimate search results:

Get-Mailbox | Search-Mailbox -SearchQuery {From:"" OR From:"" OR From:""} -EstimateResultsOnly

Open in new window

3. If you are satisfied with the results, you can then run the following command to delete the email found during the search:

Get-Mailbox | Search-Mailbox -SearchQuery {From:"" OR From:"" OR From:""} -DeleteContent

Open in new window

Your only other option other than the Search-Mailbox cmdlet is to use Outlook while connected to the mailbox.  Keep in mind Outlook uses Advanced Query Syntax to search for email:

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
ncomperAuthor Commented:
Thanks Guys,
  Thought it would be that easy. Ill have a try and post back with any questions
AmitIT ArchitectCommented:
Just remember PS command is not reversible. Once data is deleted there is no way to recover until  you have old backup. I suggest you to pipe it to target folder. In case you are not sure. So, you can recover emails easily in case it is needed.
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.