Please note, I talk a lot about Sunbelt's Exchange Archiver below but this purge script could be used with other archive solutions or even without one, just as a purge. Obviously you will want to take care that you don't purge valuable data. The Exchange server I'm running this on is Exchange 2003.
PROBLEM
Implemented Sunbelt Exchange Archiver (SEA) but wanted more control over how emails were purged from the actual Exchange server. I wanted specific policies for my user's Inbox, Sent Items, Deleted Items, and our Spam folder. SEA removes emails from Exchange and leaves short-cuts or "stubs" which allows you to still open the emails, they just get retrieved from the archive server instead of Exchange. I have SEA setup to remove the emails after 3 months leaving stubs, SEA has a global setting as to how long to keep these stubs in Exchange / Outlook. I have SEA setup to keep these for 4 years but I really didn't want them hanging around for that long in certain folders. I figure if the user takes the time to file the message in a folder, they can keep the stub for 4 years, otherwise if it is left in the Inbox or Deleted folder it shouldn't hang around as long. Even though the stub isn't taking up that much space in Exchange, it can make Outlook run slow. For example, say a user never files anything and keeps all emails in their inbox. Their inbox may have say 30,000 items in it. Okay, maybe the Exchange server is only holding the full emails for the last 3 months (in my case) it still has all these stubs to deal with and index. When the user switches sort orders, Outlook has to work with all 30,000 items to rearrange the sort, making it very slow. My thinking is that if it is over 1 year old and still in the Inbox they probably don't care about it any longer. If they do need to find it, they can search for it in the Archive as it will still be there.
Here are my policies that I wanted to implement: