It looks like I should use “New-MailboxSearch” and its own parameter like 
“–startdate” , “-enddate” and so on.

Thanks!


Rami

From: [email protected] [mailto:[email protected]] On 
Behalf Of Sean Martin
Sent: Wednesday, June 25, 2014 5:04 PM
To: [email protected]
Subject: Re: [Exchange] RE: Is there an easy way to report on how many emails 
over 6 yrs old on Exchange 2013?

I meant to specify this was on Exchange 2010, so I'm not sure if the same 
commands work on Exchange 2013.

- Sean

On Wed, Jun 25, 2014 at 4:02 PM, Sean Martin 
<[email protected]<mailto:[email protected]>> wrote:
We have a few mailboxes that have been used as dumping grounds for e-mail 
notifications from various monitoring applications for many years. Some of 
these mailboxes receive tens of thousands of messages a day. I implemented the 
following script to trim contents of these mailboxes, with the mailbox names 
being fed via text file. You can modify the datestring variable to your needs 
and just use the reporting portion of the code below.

#################
### Variables ###
#################

$date = get-date
$datestring = $date.AddDays(-15).ToString("M/dd/yyyy")
$inputfile = "C:\Scripts\Exchange\mailbox15day.txt"
$mailboxes = get-content $inputfile

#############################################################
### Send report of contents over 15 days old to Mailadmin ###
#############################################################

foreach ($mailbox in $mailboxes){Search-mailbox -Identity $mailbox -searchQuery 
"received:<$datestring" -targetMailbox "mailadmin" -targetFolder 
"SearchandDeleteLog" -Logonly -Loglevel Full}

########################################
### Delete contents over 15 days old ###
########################################

foreach ($mailbox in $mailboxes){Search-mailbox -Identity $mailbox -searchQuery 
"received:<$datestring" -DeleteContent -force}


- Sean

On Wed, Jun 25, 2014 at 1:31 PM, Michael B. Smith 
<[email protected]<mailto:[email protected]>> wrote:
You could write a MAPI program or an EWS program.

I’d probably go with EWS since I could write it in PowerShell.

Of course, you could go old-school with vbscript and redemption also. ))

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] 
On Behalf Of Rami SIK
Sent: Wednesday, June 25, 2014 4:57 PM
To: [email protected]<mailto:[email protected]>
Subject: [Exchange] Is there an easy way to report on how many emails over 6 
yrs old on Exchange 2013?

I could think of New-MailboxSearch but any other way?

Rami



________________________________

If this message is not meant for you, do not use it - please let us know, and 
then delete it. We try hard to keep our messages and attachments free of 
viruses and other malicious programs, but are not liable if our precautions 
don't prevent their spread.


Reply via email to