Exchange 2010 Script Needed to Delete Mail Older than 120 days

Posted on 2014-04-04
Last Modified: 2014-04-23
I'm looking for a script for Exchange 2010 that will delete mail older than 120 days in all user mailboxes.  It would need to be something I can schedule to run on a daily basis.

Question by:fireguy1125
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 39978616

Author Comment

ID: 39978808
I can't use retention policies, as they will apply to the archive mailbox of the users also.  Need to have a solution in which e-mail will get deleted from the mailbox, but not impact the archive mailbox.
LVL 19

Accepted Solution

suriyaehnop earned 500 total points
ID: 39981735
Try look at this, basically you have to use search-mailbox with -searchquery

Search-Mailbox -Identity "Starr, Ringo" -SearchQuery "Received:> $($Today) and Received:(Today) 

Open in new window

However, Search Query doesn't contained "Received"

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
In this video we show how to create an email address policy 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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

691 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