How do I automatically purge items older than 30 days in the Inbox, Sent Items, and Deleted Items folders in Exchange 2007?
There are actually four steps to set this up. They can all be done from PowerShell, which is awesome, but they can also be done through the Exchange Management Console. I'll cover both methods.
Step 1 - New Managed Content Settings
In Exchange Management Console, select Microsoft Exchange -> Organization Configuration -> Mailbox -> Managed Default Folders. From here, select each folder you wish to create Managed Content Settings (read: retention/journaling policies) and click "New Managed Content Settings..." from the Actions menu on the right.
Step 2 - New Managed Folder Mailbox Policy
Now skip over to the Managed Folder Mailbox Policies tab. Click "New Managed Folder Mailbox Policy" and Add the folders you want to group together. This grouping is important because you can only apply one "Policy" to a given user.
In practice this means if I want my retention settings for Inbox and Sent Items that I set up in Step 1 to apply to USER1, I need to add both of those folders to one Policy. If I want the retention settings for Sent Items and Deleted Items to apply to USER2 and USER3, I need to add both of those folders to another Policy.
Step 3 - Messaging Records Management - Recipient Configuration
Still on Exchange Management Console, drill down to Microsoft Exchange -> Recipient Configuration -> Mailbox and double-click on a user. Go to the Mailbox Settings tab on the user Properties window and double click on "Messaging Records Managment". Here you need to select a Managed folder mailbox policy (you created this in Step 2) for this user.
Here's where I reccomend using PowerShell if you have more than a few users to assign this policy to. PowerShell script example coming tomorrow.
Step 4 - Messaging Records Management - Server Configuration
Finally, drill down to Microsoft Exchange -> Server Configuration -> Mailbox and double-click on a Mailbox Server. Go to the Messaging Records Management tab and create a Custom Schedule when to apply the Policy.
Think of this as a scheduled task with a "Stop the task if it runs for X hour(s) X minute(s)." The only difference is that this scheduled task picks up where it left off when it stopped. So, if I schedule it to run at 12AM for one hour each night and it doesn't finish processing through all the mailboxes it is assigned to, it will continue at 12AM on Monday.
One final note, you should do this during light usage hours because this can be intensive on your Exchange Servers and Outlook (think synchronization, especially on the initail run).
That's pretty much it. For more details and PowerShell commands from Microsoft, take a look here (remember it's technet so Internet Exporer or IE emulation will give you a "better" view):