Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powershell script to delete old mail items from exchange 2k3

Posted on 2010-08-17
3
Medium Priority
?
1,630 Views
Last Modified: 2012-05-10
Hello everyone,

I was hoping to get some help writing a powershell script that do the following:

1) Connect to exchange 2k3 (with latest SP installed).
2) Gain access to mailboxes (either individual or bulk mailboxes)
3) Look for mail items that are older than "x" amount of days
4) Once it finds mail items are that older than the specified date, go ahead and delete those mail items.

Exchange is running on win2k3 with latest SP. I'm also using PS 2.0 CPT 3.  Not sure if this can be done with exchange 2k3, but it's worth the try for me as we are getting ready for a email migration and trying to remove Enterprise Vault archiving solution icons/shortcuts from users mailbox.

Please let me know if you have any questions, or if there's anything that isn't clear.

Thanks in advance.
0
Comment
Question by:bloodywicked
3 Comments
 
LVL 32

Assisted Solution

by:endital1097
endital1097 earned 200 total points
ID: 33457701
i think you are looking for something like this
http://support.microsoft.com/kb/319188
0
 
LVL 4

Accepted Solution

by:
mukulag earned 1800 total points
ID: 33463267
# Delete content from user's mailbox depending upon the criteria

Get-Mailbox -Server ServerMbx1 -resultsize unlimited | Export-Mailbox -DeleteContent -EndDate 10/08/2009 -IncludeFolders "\Inbox"
 
The above command will delete all emails from ALL mailboxes on ServerMbx1. Be careful when you do this as the results are irreversible. I would recommend to run the above command against a specific mailbox first as below:
Get-Mailbox -MAILBOXNAME | Export-Mailbox -DeleteContent -EndDate 10/08/2009 -IncludeFolders "\Inbox"

 
0
 

Author Closing Comment

by:bloodywicked
ID: 33534853
exactally what i was looking for.

thank you all.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
Stellar Exchange Toolkit: this 5 in 1 toolkit comes loaded with mega-software tool. Here’s an introduction to tools’ usage and advantages:
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question