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 26
yo_beeDirector of Information TechnologyAsked:
Who is Participating?
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
0
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).
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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
0

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.
0
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
0
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
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.