I'm trying to write an EX2010 SP1 EMS command to delete a message with the following attributes:
Rcv'd between: 3/26/2012 & 3/27/2012
Subject: blah blah
Sent to: specific user
I've tried the following but I get an error:
get-mailbox "user.name" |search-mailbox -searchquery 'subject:"blah blah"
' -StartDate "3/26/2012" -EndDate "3/27/2012" -deletecontent
The error I get:
A positional parameter cannot be found that accepts argument '3/26/2012'.
+ CategoryInfo : InvalidArgument: (:) [Search-Mailbox], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Search-Mailbox
If I remove the -startdate and -enddate, it's successful, but it searches and deletes all messages with subject 'blah blah', which is not what I need.