We have a separate archiving appliance that archives messages as they come in using a journal account. Before this I would have to manually archive each mailbox to a PST file and then store the file on our storage server. Luckily I don't have to do that anymore.
My question is, using Powershell, is it possible to go in to each (or all at once) mailbox and remove email messages before a certain date? This would prevent me from still having to archive each mailbox to a PST file, even though I could delete the PST file later. I don't want to touch calendar items, only mail items (folders and subfolders).
If you have Exchange Server 2007 SP1, you can use the
Export-Mailbox
cmdlet, with the-DeleteContent
flag and without a target, to simply delete to email items that otherwise would have been exported:In the example, all items in all folders, from before 90 days ago, will be deleted. You'll need to have FullAccess rights on each mailbox you perform this operation on.
To exclude certain folders, like Contacts or Calendar, use the
-ExcludeFolders
flag, like this: