Solved

EX2010 SP1 - Deleting a Message using EMS

Posted on 2012-03-27
3
716 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
ID: 37775453
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
ID: 37776244
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
ID: 37779154
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Migrating users to new exchange 2010 DB 7 40
365 Postmaster Spam 2 25
Office 365 Maximum Recipients limitation 3 32
Exchange 2007 Standard Database Move 5 23
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
In-place Upgrading Dirsync to Azure AD Connect
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

860 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