Exchange 2010 Powershell Search-mailbox Syntax

I want to search and destroy e-mails with a subject and Sent date

My syntax

Get-Mailbox -identity <name> | Search-Mailbox -SearchQuery {'Subject:"*Daily Revenue*" and Sent:"8/23/2015"'} -DeleteContent -Force

Open in new window

is this correct?
LVL 27
yo_beeDirector of Information TechnologyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

K BCommented:
Get-Mailbox -Server  "*Server*" | Search-Mailbox -SearchQuery 'Subject:"*Subject*" and Body:"*Body*"' -deletecontent

Or backup (sort of) the emails first ...

Copy all emails to a single mailbox, then delete the emails

Get-Mailbox -Server  "*Server*" | Search-Mailbox -SearchQuery 'Subject:"*Subject*" and Body:"*Body*"' -targetmailbox "*SearchMailbox*" -targetfolder "*SearchFolder*" -loglevel full -deletecontent
yo_beeDirector of Information TechnologyAuthor Commented:
Thanks for the link, but I am asking is my syntax correct.
From what I can see in the example in the link I am putting  both the subject and sent date correctly. When I run it I get a long list of errors (which I cannot post at this moment).
Virus Depot: Cyber Crime Becomes Big Business

The rising threat of malware-as-a-service is not one to be overlooked. Malware-as-a-service is growing and easily purchased from a full-service cyber-criminal store in a “Virus Depot” fashion. View our webinar recording to learn how to best defend against these attacks!

K BCommented:
Have a look at this syntax:

Get-Mailbox –Database VIP –ResultSize Unlimited | Search-Mailbox -TargetMailbox AdminSearchMailbox -TargetFolder “Search Results” -SearchQuery {Subject:"Interesting" AND From:"Ben Andrews" AND Sent:"10/13/2014"} -DeleteContent -LogLevel Full –SearchDumpster

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
yo_beeDirector of Information TechnologyAuthor Commented:
I have not stumbled across this one yet. When I get home I will try it.
yo_beeDirector of Information TechnologyAuthor Commented:
This helped me find the right path, but it turned out that the Syntax for the Date part can not me in quotes and I had to run it from the CAS  because of roll I have for my account.

Now there is another obstacle that I need to address ADRMS protected E-mails.

Get-Mailbox -Identity  UserName | Search-Mailbox -SearchQuery  {Subject:"*Daily Revenue*" AND received:8/23/2015} -DeleteContent -Force

Open in new window

Thanks for your help
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.