Search and Delete Messages from User Mailboxes – Exchange 2010

Hi Readers,

Today I am sharing the method to remove messages from exchange mailboxes.

Note:- Indexing should be working fine otherwise there would be issues in removing messages from mailboxes.

Create a CSV file for user mailboxes on which you want to take action:

Capture

Just logging: 

import-csv c:\tmp\Messagesubject.csv | foreach {Search-Mailbox $_.alias -SearchQuery subject:“Vikas Sukhija Schedule” -TargetMailbox “LogMailbox” -TargetFolder “Logs” -LogOnly -LogLevel Full} >c:\tmp\output.txt

Capture1

 

Move & Delete Messages:

import-csv c:\tmp\exchange2010.csv | foreach {Search-Mailbox $_.alias -SearchQuery subject:”Vikas Sukhija Schedule” -TargetMailbox “LogMailbox” -TargetFolder “Logs” -DeleteContent -force} >  c:\tmp\moveanddel.txt

Delete Messages:

import-csv c:\tmp\exchange2010.csv | foreach {Search-Mailbox $_.alias -SearchQuery subject:”Vikas Sukhija Schedule” -DeleteContent -force} > c:\temp\output.txt

Follow the next article to convert the output log to CSV so that its easy to read:

http://msexchange.me/2014/08/25/convert-structured-text-to-csv-format/

Regards

Sukhija Vikas

http://msexchange.me

Advertisements

3 thoughts on “Search and Delete Messages from User Mailboxes – Exchange 2010

  1. Pingback: Convert Structured TEXT to CSV format | Microsoft Technologies Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s