Here is an example, that searches for a message with a specific subject and removes it:
Search-Mailbox -Identity "Byron Wright" -SearchQuery 'Subject:"Insider Info"' -DeleteContent
If you want to remove this message from all mailboxes, you would do it like this:
Get-Mailbox | -SearchQuery 'Subject:"Insider Info"' -DeleteContent
The key to using the cmdlet to remove messages is making sure that your query captures only the messages you want. I strongly suggest verifying the query results first not matter how much of a hurry you are in. The easy way is to use the -LogOnly and -LogLevel parameters. You need to define the log level as Full to capture query results.
Get-Mailbox | -SearchQuery 'Subject:"Insider Info"' -LogOnly -LogLevel FullNote: Using multi-mailbox search requires an Exchange enterprise client access license for each mailbox searched.
No comments:
Post a Comment