How to delete old emails from Exchange server 2007 using shell script
Hi, I have to delete 6 months old mails from the mailbox of some users (300 users). All the users are using OWA only. Kindly suggest is there any way to delete the emails old than 6 months just by running the Powershell script on Exchange Server. Regards Supreet Singh
May 19th, 2010 6:13pm

Hi I think you can achieve by using messaging records management http://www.msexchange.org/articles_tutorials/exchange-server-2007/compliance-policies-archiving/exchange-2007-messaging-records-management-part1.htmlJonas Andersson MCTS: Microsoft Exchange Server 2010, Configuration | MCITP: EMA | MCSE/MCSA Blog: http://www.testlabs.se/blog
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2010 8:51pm

hi jonas, this will solve organisation wise. But supreet is looking forward for a some specific users. as he mentioned in the question
May 19th, 2010 10:51pm

Hi Supreet, You can use cmdlet Export-Mailbox with parameter -DeleteContent and -EndDate to delete mails. First, suggest you read this document: How to Export Mailbox Data http://technet.microsoft.com/en-us/library/bb266964(EXCHG.80).aspx For your question, you can use filter to get some users then pipeline the results to Export-Mailbox. More information about Export-Mailbox http://technet.microsoft.com/en-us/library/aa998579(EXCHG.80).aspxFrank Wang
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2010 5:53am

Hi Frank, Thanks for your suggestion. I got this done with this script "Export-Mailbox -Identity test2 -StartDate "05/05/2010" -EndDate "05/06/2010" -DeleteContent" I have around 300 users having generic IDs whose old emails has to be deleted. And the user name starts with a common word (lets say 'Test' - Test1111,Test1222,test2333,Test4444). I need something like to export the output from the get-user or get-mailbox command with a filter on the basis of email id/user name and forward this output with the help of PIPE command to the above given script. Kindly suggest. Regards Supreet Singh
May 23rd, 2010 10:30am

Hi Supreet, You can run this cmdlet to get the filter results: Get-User | where { $_.name -like "Test*" } Frank Wang
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2010 5:15am

Thanks everyone, I got the solution to delete content from the specific dates by below. Export-Mailbox -Identity test2 -StartDate "05/05/2010" -EndDate "05/06/2010" -DeleteContent"
February 2nd, 2011 5:46am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics