Solved

EX2010 SP1 - Deleting a Message using EMS

Posted on 2012-03-27
3
713 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:NAMEWITHELD12
  • 2
3 Comments
 
LVL 36

Accepted Solution

by:
Jian An Lim earned 500 total points
Comment Utility
you use -SearchQuery “Subject:Exchange”,”Sent:today”

or -SearchQuery “Subject:Exchange”,”Receive:today”

Or something like that, you can put sent and receive criteria but startdate and enddate is not valid command i believe.
0
 
LVL 1

Author Comment

by:NAMEWITHELD12
Comment Utility
Are there other command variables than just today?  I ask b/c now the message was received on the 27th...
0
 
LVL 36

Expert Comment

by:Jian An Lim
Comment Utility
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)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now