Exchange Email Clean

ncomper
ncomper used Ask the Experts™
on
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: Manager@SoldDomain.com
Remove email from the following addresses:
Email Address: Director@domain.com
Email Address: FD@domain.com
Email Address: owner@domain.com

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.

Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AmitIT Architect
Distinguished Expert 2017
Commented:
You can use search-mailbox command. Refer:
https://technet.microsoft.com/en-us/library/dd298173(v=exchg.160).aspx

Check the example and customize it as per your requirement.
Commented:
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 manager@solddomain.com example):

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

Get-Mailbox manager@solddomain.com | Search-Mailbox -SearchQuery {From:"Director@domain.com" OR From:"FD@domain.com" OR From:"owner@domain.com"} -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 manager@solddomain.com | Search-Mailbox -SearchQuery {From:"Director@domain.com" OR From:"FD@domain.com" OR From:"owner@domain.com"} -DeleteContent

Open in new window

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

https://msdn.microsoft.com/en-us/library/aa965711%28v=vs.85%29.aspx

Author

Commented:
Thanks Guys,
  Thought it would be that easy. Ill have a try and post back with any questions
AmitIT Architect
Distinguished Expert 2017

Commented:
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.

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