• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2124
  • Last Modified:

MS Exchange 2007 Powershell script to delete emails on all mailboxes older than a date i specify

My boss has handed me a task to cleanup soem emails on our server. Thsi si something for the moment that i do not want ot automate.  I have read the articles about the Managed folders and will implement this at a alter date.  What i am tryign to find is a powershell script for MS exchange 2007 SP1 that i can run that will look at all mailboxes and delete ANY email, calendar item and such over 3 years old.  Can anyone help i have been searchign for hours with no luck.

Thanks
Don C
0
donnyiris
Asked:
donnyiris
  • 3
  • 2
2 Solutions
 
fred3rdCommented:
Here's something I found from http://msexchangeteam.com/archive/2010/10/27/456739.aspx
Get-Mailbox -Server Server1 -ResultSize Unlimited | Export-Mailbox -SubjectKeywords "Friday Party" -IncludeFolders "\Inbox" -StartDate "09/07/2010" -EndDate "09/09/2010" -DeleteContent -TargetMailbox MyBackupMailbox -TargetFolder DeleteMsgs -Confirm:$fals

Open in new window

0
 
Tony JLead Technical ArchitectCommented:
export-mailbox Administrator -PSTFolderPath C:\temp\ -DeleteContent -endDate 11/30/2009

This command actually exports them to a PST rather than simply deleting them which means you could restore them if required.
0
 
donnyirisAuthor Commented:
Will that doo all mailboxes?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
fred3rdCommented:
If the question is for me, then yes, it will do all mailboxes.
0
 
donnyirisAuthor Commented:
That command only does Administrator this does everything on the server before this date and only validates figured id post it.

Get-Mailbox -Server YourMailServerName| Export-Mailbox -PSTFolderPath H:\temp\ -EndDate "09/30/2007 12:01:00" -DeleteContent -validateonly
0
 
fred3rdCommented:
Both Tony and I combined to give Donny his command. He should give either one of us the points.
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now