Solved

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

Posted on 2010-11-16
6
2,016 Views
Last Modified: 2012-06-27
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
Comment
Question by:donnyiris
[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
  • 2
6 Comments
 
LVL 1

Expert Comment

by:fred3rd
ID: 34147420
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
 
LVL 25

Accepted Solution

by:
Tony Johncock earned 250 total points
ID: 34147442
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
 

Author Comment

by:donnyiris
ID: 34147586
Will that doo all mailboxes?
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 1

Assisted Solution

by:fred3rd
fred3rd earned 250 total points
ID: 34147861
If the question is for me, then yes, it will do all mailboxes.
0
 

Author Comment

by:donnyiris
ID: 34148242
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
 
LVL 1

Expert Comment

by:fred3rd
ID: 34148311
Both Tony and I combined to give Donny his command. He should give either one of us the points.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
In this video we show how to create an Address List 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 Organization >> Ad…
To show how to generate a certificate request 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 Servers >> Certificates…

749 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