Link to home
Start Free TrialLog in
Avatar of NAMEWITHELD12
NAMEWITHELD12Flag for United States of America

asked on

EX2010 SP1 - Deleting a Message using EMS

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.
ASKER CERTIFIED SOLUTION
Avatar of Jian An Lim
Jian An Lim
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NAMEWITHELD12

ASKER

Are there other command variables than just today?  I ask b/c now the message was received on the 27th...
i don't have an exchange 2010 with me,

my guess it will take a day.

      

like sent:28/03/2012 (or MM/DD/YY depends on your date format)