Link to home
Start Free TrialLog in
Avatar of ianmclachlan
ianmclachlan

asked on

Exchange 2010 - Powershell to delete specific content per folder by date

Hi Guys,

Anyone got a PS script that will allow me to delete specific content for a users mailbox.  ie.  "I want to delete everything up to 2016 from the sent items folder for user joe bloggs".  I have been playing around with the search-mailbox function, but I'm struggling with the syntaxt of defining a particualar folder.  I can remove ALL mail by date, I just need to define from which folder I want the criteria to remove.

Thanks for your help guys.

IM
Avatar of Rajul Raj
Rajul Raj
Flag of United Arab Emirates image

Below link will be usefull. It has nice writeup for your query

https://www.petri.com/delete-email-from-microsoft-exchange-user-mailboxes-using-powershell
Avatar of ianmclachlan
ianmclachlan

ASKER

Hi Rajul Raj,

Thanks for your comments.  I'm up to speed with this method.  However, it doesn't explain how you filter by folders ie "Sent items" or "inbox" etc..  I want to remove ALL email from the "sent items" folder up to 2016.  So, I don't want any other emails being selected/removed, I just want the selection to be concentrated on the "sent items" folder only.

Hope that makes sense.

Thanks,

IM
Hi Guys,

I don't think it's possible.  As a way around this is:  I have created a retention policy tag to delete last 6 months of email from sent items.  I created a retention policy and applied the tag and applied the mailbox.  Once the folder-assistant runs it should remove the email ... I hope.

Will keep you posted

IM
Avatar of Tim Edwards
It all depends on how you setup your tag, this is the correct method of doing this.

If you setup them up to delete and recovery they will go into your delete items recovery folder, depending on your days to purge this you can add that onto when they get removed before they are actually purged.

You can verify that that the tag has been applied by going to your older sent items as they should have a date when the item expires
ASKER CERTIFIED SOLUTION
Avatar of ianmclachlan
ianmclachlan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It is only good if you want to do organization wide and have a policy in place, but for a one off request it is not the best way of doing it.
It's used for road warriors who use ipads and/or OWA.  Without Outlook, I've never found an efficient method of archiving/removing old/unwanted email.  Perhaps, you could enlighten me as to the correct method?

IM
For archiving you could always setup an archive database, same thing you can create the policies to automatically do it as well the user can setup archive rules on their outlook.
It worked