kennysarmy Posted May 23, 2019 Posted May 23, 2019 Does anyone have a powerhell script that could delete emails from a users mailbox (In-box only) if they are older than X number of days? Cheers
djm968 Posted May 23, 2019 Posted May 23, 2019 search-mailbox -identity -searchquery {received:mm/dd/yyyy..mm/dd/yyyy} -deletecontent
kennysarmy Posted May 23, 2019 Author Posted May 23, 2019 search-mailbox -identity -searchquery {received:mm/dd/yyyy..mm/dd/yyyy} -deletecontent Thanks - will that do all folders or just the inbox?
kennysarmy Posted May 23, 2019 Author Posted May 23, 2019 Pretty sure it will do entire mailbox. Thanks, I only need to delete the emails from their inbox, so will keep searching for a solution.
Boredguy Posted May 23, 2019 Posted May 23, 2019 If it's just from their inbox, you can set a mailbox retention rule to remove mail over X days. It does not affect items in sub folders from our testing (since we're rolling out 1 year retention policy for staff at the start of the new year)
djm968 Posted May 23, 2019 Posted May 23, 2019 Thanks, I only need to delete the emails from their inbox, so will keep searching for a solution. Should be use Get-MailboxFolder User:\Inbox to target search to just inbox. I will have a look if I can knock something up when I get 5 mins.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now