Solved

Office 365 remove messages by date range for several users using powershell

Posted on 2014-11-13
2
2,284 Views
Last Modified: 2014-11-25
Hi,

I have an Office365 account, we have several mailboxes. We would like to delete message for several users by date range. Is there a way with powershell?

Deleting using Outlook or Outlook Web App will take too long.
0
Comment
Question by:NRTCF
2 Comments
 
LVL 9

Accepted Solution

by:
Veerappan Sundaram earned 500 total points
ID: 40441906
Before you do this, please check the legal requirements of your organization on "Email retention"

Do you have access to O365 Online Administration Center? Do you have required permission to run Exchange cmdlets?

If yes, you need to use the Remote Windows Powershell to run Search-Mailbox cmdlet to delete content.

please refer this link: http://technet.microsoft.com/en-us/library/exchange-online-administration-and-management.aspx

search-mailbox -identity "user_ID" -searchquery {sent:01/01/2010..01/01/2012} -TargetMailbox "different_Mbx_name" -targetfolder "folder_name" -logonly   (Run this to confirm you get the expected result before deleting)

Search-Mailbox -identity "User_ID" -searchquery {sent:01/01/2010..01/01/2012} -Deletecontent

Thanks,
Veera.
0
 
LVL 5

Expert Comment

by:Mai Ali (MVP)
ID: 40450328
you can remove emails for one user by using the Search-Mailbox cmdlet with the DeleteContent parameter to search for and delete messages in one step
For delete message for several users by date range, You can use Search For and Delete Messages from Users' Mailboxes
0

Featured Post

Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

Join & Write a Comment

If you don't know how to downgrade, my instructions below should be helpful.
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…
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…
This Experts Exchange lesson shows how to use VBA to loop through rows in Excel.  In order to sort, filter, and use database features, there needs to be a value in each column for every row. When data arrives with values missing, code to copy values…

744 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

13 Experts available now in Live!

Get 1:1 Help Now