Export-Mailbox is a great tool for exporting mailbox content to another Mailbox or PST file, but it is also a great tool to use for removing messages from Mailboxes.

I have used this command on Exchange Server 2007 SP2

Prerequest: Outlook need to be installed on the server to run the powershell

consider the useremail: bawin @ shareitskills.com and the file server path \\sits-filesvr\PST-Archives (you can use the local path, c:\pst-archive\)

Export-mailbox -Identity shareitskills\bawin -PSTFolderPath \\sits-filesvr\PST-Archives -StartDate 1/1/2005 -EndDate 31/12/2010

If you want to delete the contents during the export:

Export-mailbox -Identity shareitskills\bawin -PSTFolderPath \\sits-filesvr\PST-Archives -StartDate 1/1/2005 -EndDate 31/12/2010 -DeleteContent -confirm:$False

Powershell to Delete Content of the mailbox through Export-Mailbox

Export-Mailbox <username> -DeleteContent -confirm: $False

 

This link provides details: http://technet.microsoft.com/en-us/library/bb266964