Solved

Received in "Search-Mailbox - SearchQuery" issue (Exchange 2013)

Posted on 2016-11-03
2
45 Views
Last Modified: 2016-11-04
This does not work because of "Receive"

$today=(get-date).adddays(-30)
$data = import-csv C:\NB\Emails\users.csv

foreach ($i in $data)

  { $alias = $i.mailbox;

    Search-Mailbox -id $alias -SearchQuery 'From:"Someone@verizon.net" AND Received:<$($today)' -DeleteContent
}

It work if I put a specific date - Received>=10/31/201

what am I doing wrong?
0
Comment
Question by:nourben
2 Comments
 
LVL 6

Accepted Solution

by:
CodeTwo Software earned 500 total points
ID: 41873729
Hi nourben,

The problem might be the date format - have you tried (get-date).adddays(-30).tostring(MM/dd/yyyy)?

- CodeTwo
1
 

Author Comment

by:nourben
ID: 41874214
Thanks, it worked with a minor change (get-date).adddays(-30)tostring('MM/dd/yyyy')

I also had to change: Received<$today
1

Featured Post

Will my email signature work in Office 365?

You've built an email signature using raw HTML code in Office 365, but you can't review how it looks with Transport Rules. So you have to test it over and over again before it can be used. Isn't this a bit of a waste of your time? Wouldn't a WYSIWYG editor make it a lot easier?

Question has a verified solution.

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

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
This video discusses moving either the default database or any database to a new volume.

910 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

20 Experts available now in Live!

Get 1:1 Help Now