question

RavenConsultancy avatar image
0 Votes"
RavenConsultancy asked ·

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 !?!?!

office-exchange-server-administration
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

michev avatar image
0 Votes"
michev answered ·

Stamp a retention policy on it, it's the easiest solution and will also help you avoid such issues in the future: https://docs.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.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EricYin-MSFT avatar image
0 Votes"
EricYin-MSFT answered ·

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”

76497-3.png




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.



3.png (146.1 KiB)
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RavenConsultancy avatar image
0 Votes"
RavenConsultancy answered ·

Thanks so much to both of you for your really helpful and detailed answers !

You guys are awesome.

!?!?! Raven !?!?!

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.