Solved

Powershell script to delete old mail items from exchange 2k3

Posted on 2010-08-17
3
1,613 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 50 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 450 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now