Solved

Powershell script to delete old mail items from exchange 2k3

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This article explains how to install and use the NTBackup utility that comes with Windows Server.
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…
This video discusses moving either the default database or any database to a new volume.

739 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