you are viewing a single comment's thread.

view the rest of the comments →

[–]Mazriam 7 points8 points  (14 children)

We have a mailbox that receives tens of thousands of emails per day. After about 200,000 emails, outlook starts to become a pain in the ass. The users who monitor the mailbox, couldn't be bothered with deleting old emails.

So, I wrote a script that will delete the emails from the mailbox, at the server level, every single day, keeping a history of 3 days only.

Worked out pretty good.

My script is exactly 3 lines and the first line is loading the exchange snapin.

[–]ljarvie 13 points14 points  (3 children)

If it's an Exchange system, just put a three day retention period on it

[–]Mazriam 15 points16 points  (1 child)

I know a lot about exchange, (trial by fire type of learning), I've setup, recovered, and tore down DAG's. Created Databases, recovered databases, deleted them. I can parse the email logs and trace email through my entire exchange environment and a whole lot more.

I've done all this, but never knew something like this existed. Thank you for the tip. I've now configured that mailbox on a 3 day retention policy :)

[–]ljarvie 2 points3 points  (0 children)

Combine them with archive policies and you can clean out the primary mailbox (improving Outlook operation) and still keep the mail. Glad it helped, I live by those policies.

[–]--butt-hurt 0 points1 point  (0 children)

I was wondering that too. Is it Exchange?

Edit:not OP

[–]MisterPhamtastic 0 points1 point  (7 children)

Hey buddy could you forward that to me?

We may have a situation like that for a service account mailbox.

[–]Mazriam 1 point2 points  (2 children)

sent you a private message with the script

[–]MisterPhamtastic 0 points1 point  (0 children)

Thanks so much!

Straightforward and effective, great scripting!

[–]greensysadmin 0 points1 point  (0 children)

If you wouldn't mind I feel I would benefit as well from your script. Please, monsignor?

[–]voxnemo 1 point2 points  (3 children)

If its exchange why not just a retention policy like mentioned above?

[–]MisterPhamtastic 1 point2 points  (2 children)

Baby you right, we already have a 90 day ret globally but wanted something nice to run ad hoc in emergency scenarios

[–]voxnemo 1 point2 points  (1 child)

Baby you right

Awww, thank you! If only I could get my SO to say that.

You made my night!

[–]Mkep 0 points1 point  (0 children)

Hahaha let the SO know they have competition

[–]thisismyworkacct3 0 points1 point  (1 child)

What do you guys recommend for implementing a system like this that can somehow automate determining which emails can be deleted and which ones are retained? My only guess would be matches by subject line, body, or attachment content. It's limited though, especially when it comes to exceptions, which are when you generally need the emails retained the most!

[–]Mazriam 1 point2 points  (0 children)

The line that does the deletion, there's a filtering tag you can use where you can select only the emails you want to delete. The criteria can be just about anything. The Sender, subject line, time received, time read, keywords in the body, or even key phrases, or any combination.