Stamp a retention policy on it, it's the easiest solution and will also help you avoid such issues in the future: https://learn.microsoft.com/en-us/exchange/policy-and-compliance/mrm/create-retention-policies?view=exchserver-2019
If you do want to clear items via more manual approach, use the Search-Mailbox cmdlet with the -DeleteContent switch.
Is it possible to delete the contents of a mailbox's inbox using the Exchange 2016 Management Shell ?
A deployment is using an external third party mail gateway, and this has mandated the creation of a user mailbox within their instance of Exchange 2016 Standard, to serve as a journaling mailbox for internal e-mails.
This is all fine conceptually, but the internal mailbox is not emptying when it passes the e-mails over to the third party gateway for logging, and it has somehow grown to approximately 250GB in size, which is obviously causing problems for the server.
Given its size, I cannot readily see how I could issue a command to purge the contents of this mailbox's inbox other than via the Exchange Management Shell, and so I was wondering if anybody here knows how to permanently delete the contents of a user's inbox via the Exchange Management Shell and, if so, how you would go about doing it.
Thanks so much for your time in advance, and I hope you are all keeping safe and well :)
!?!?! Raven !?!?!
-
Vasil Michev 95,666 Reputation points MVP
2021-03-10T19:50:55.73+00:00
2 additional answers
Sort by: Most helpful
-
Eric Yin-MSFT 4,386 Reputation points
2021-03-11T02:09:06.413+00:00 You can use the following Exchange command to delete messages that he receives in a specific period:
Search-Mailbox username -SearchQuery {Received:04/01/2019..04/11/2019} -DeleteContent -Force
You need to assign the roles using EAC or these PowerShell commands before running the command:
New-ManagementRoleAssignment -User j.anderson -Role "Mailbox Import Export" New-ManagementRoleAssignment -User j.anderson -Role "Mailbox Search”
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. -
Raven Consultancy 21 Reputation points
2021-03-11T07:41:19.59+00:00 Thanks so much to both of you for your really helpful and detailed answers !
You guys are awesome.
!?!?! Raven !?!?!