Is it possible to delete the contents of a mailbox's inbox using the Exchange 2016 Management Shell ?

Raven Consultancy 21 Reputation points
2021-03-10T15:48:44.4+00:00

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

Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,344 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 95,096 Reputation points MVP
    2021-03-10T19:50:55.73+00:00

    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.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. 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”  
    

    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.

    0 comments No comments

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

    0 comments No comments