Solved

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

Posted on 2016-11-03
2
67 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 7

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In-place Upgrading Dirsync to Azure AD Connect
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

839 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