?
Solved

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

Posted on 2014-11-13
2
Medium Priority
?
2,914 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
[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
2 Comments
 
LVL 9

Accepted Solution

by:
Veerappan Sundaram earned 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
how to add IIS SMTP to handle application/Scanner relays into office 365.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Suggested Courses

801 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