Solved

Powershell script to delete old mail items from exchange 2k3

Posted on 2010-08-17
3
1,625 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
how to add IIS SMTP to handle application/Scanner relays into office 365.
Suggested Courses
Course of the Month5 days, 2 hours left to enroll

636 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