How to change how long permanently deleted items are kept for Exchange Online mailboxes using Microsoft Graph PowerShell

Items like messages, calendars, and tasks in Exchange Online are moved to a folder called Recoverable Items when they are permanently deleted. They can be recovered from this state in 14 days, by default. This period, called the retention period, can be changed and extended up to 180 days by using Microsoft Graph PowerShell scripts.

ManageEngine M365 Manager Plus, a comprehensive tool used for reporting, managing, monitoring, auditing, and alerting for critical activities in your Microsoft 365 environments, can also be used for this purpose.

The following table is a comparison on how to change retention period using Microsoft Graph PowerShell and M365 Manager Plus.

 Microsoft 365

Steps to change how long permanently deleted items are kept for Exchange Online mailboxes using Microsoft Graph PowerShell

  1. Open Windows PowerShell, connect to Microsoft Graph PowerShell, and execute the following script:
 Update-MgUserMailboxSetting -UserId "<Mailbox_Name>" -MailboxRetentionPeriod <Retention_Period>
 Copied

Click to copy entire script

 M365 Manager Plus

Steps to change how long permanently deleted items are kept for Exchange Online mailboxes using M365 Manager Plus

  1. Log in to M365 Manager Plus and navigate to the Management tab > Exchange Online > Mailbox Management > Configure Mailbox Retention Policy or Configure Shared Mailbox Retention Policy based on the type of mailbox that you want to configure the retention period for.
  2. Type in how long you want deleted items to be retained in the Retain deleted items field.
  3. Fill in the mailbox name and click Find to generate a list of matching users.
  4. Check the users that you want to delete and click Apply.
    The Configure Shared Mailbox Retention Policy  management task in M365 Manager Plus with the Retain deleted items filed filled, to change how long permanently deleted items are kept for Exchange Online mailboxes

Limitations of using Microsoft Graph PowerShell to change how long permanently deleted items are kept for Exchange Online mailboxes

  • Administrators must have sufficient permissions to modify retention period using the above-mentioned Microsoft Graph PowerShell script. However, scripts are time-consuming, can affect productivity, and are prone to errors.
  • Assigning granular permissions to execute individual tasks in a broad category is not possible.

Benefits of using M365 Manager Plus to change how long permanently deleted items are kept for Exchange Online mailboxes

One-stop solution for your Microsoft 365 management needs.

Try now for free

 

Streamline your Microsoft 365 governance and administration with M365 Manager Plus

Get Your Free Trial

Related Resources

 
x
A holistic Microsoft 365 administration and security solution
 
x