Powershell – How to run a search query based on recipient in PowerShell for Exchange 2010

exchange-2010powershell

I've tried to run the following commands but neither work and I'm not sure how I should setup the query. I tried to find a full list of available search strings but couldn't locate one online or using help.

I did find the list here (http://technet.microsoft.com/en-us/library/bb232132.aspx#AQS) but it doesn't include the search queries I am looking for (based on the fact that it doesn't even list "Received:" which I know is an option because I use it all the time.

Search-Mailbox -Identity -SearchQuery 'Received:' 'To:' -LogLevel Full –DeleteContent

Search-Mailbox -Identity -SearchQuery 'Received:' 'Recipient:' -LogLevel Full –DeleteContent

Thanks in advance!

Best Answer

Found a link with the information I needed:

http://unifiedpeople.ru/exch2010help.en/html/cf504a59-1938-489c-bb48-b27b2ac3234e.htm

Proper query for those needing the information in the future is:

Search-Mailbox -Identity -SearchQuery ' Received:' –DeleteContent