• Menu
    • Products
      EDB Recovery and Migration
      • Overview
      • Features
      • How it works
      • User Manual
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      Exchange Server Migration
      • Overview
      • Features
      • How it works
      • User Manual
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      Office 365 Migration
      • Overview
      • Features
      • How it works
      • User Manual
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      SharePoint Online Migration
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      OneDrive for Business Migration
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      Microsoft Teams Migration
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      SharePoint Backup
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      OneDrive Backup
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      IMAP Email Backup & Migration
      • Overview
      • Features
      • How it works
      • User Manual
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      Exchange Server Backup
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      Office 365 Backup
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      OST Recovery and Migration
      • Overview
      • Features
      • How it works
      • User Manual
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      MBOX Export and Migration
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      NSF Export and Migration
      • Overview
      • Features
      • How it works
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      PST Recovery and Migration
      • Overview
      • Features
      • How it works
      • User Manual
      • FAQ
      • Videos
      • Pricing
      • Screenshots
      EML to PST Export
      • Overview
      • How it works
      • Pricing
      PST to MSG Export
      • Overview
      • How it works
      • Pricing
      MSG to PST Export
      • Overview
      • How it works
      • Pricing
      • Screenshots
    • Free Tools
    • Features
    • Reseller
    • Free Trial
    • FAQ
    • Video Tutorials
    • Pricing
    • Download
    • Support
    • Account
EdbMails EDB Recovery and Migration software
  • Reseller
  • Products
    Exchange EDB / Email Recovery Tools
    • EDB Recovery and MigrationRecover EDB to PST, EDB to Office 365 and Exchange NO Duplicate Migration
    • OST Recovery and MigrationRecover OST to PST, OST to Office 365 and Exchange Migration
    • PST Recovery and MigrationRecover Outlook PST, PST to Office 365 and Exchange Migration
    • MBOX Export and MigrationExport MBOX to PST, MBOX to Office 365 and Exchange Migration
    • NSF Export and MigrationExport NSF to PST, NSF to Office 365 and Exchange Migration
    • EML to PST ExportEML files export to Outlook PST format
    • PST to MSG ExportOutlook PST files export to MSG format
    • MSG to PST ExportExport MSG files Outlook PST files
    Exchange and Office 365 Migration
    • Exchange Server MigrationMigrate Exchange 2007, 2010, 2013, 2016, 2019 to Office 365 tenants. Also, migrate between Exchange servers and PST
    • Office 365 MigrationMigrate Source Office 365 tenants to Destination Office 365 tenants. Also, migrate to Exchange Server and PST
    • IMAP Email Backup & MigrationMigrate all IMAP email servers (Gmail, Zimbra, Zoho, Yahoo etc.), Office 365, Exchange and Backup to Outlook PST
    • SharePoint Online MigrationMigrate documents, files and folders from SharePoint sites
    • OneDrive for Business MigrationMigrate documents, files and folders from OneDrive
    • Microsoft Teams MigrationMigrate Teams, documents, files and folders etc.
    Exchange and Office 365 Backup
    • Office 365 BackupIncremental, Granular, Encrypted and Compressed Office 365 Mailboxes Backup
    • Exchange Server BackupIncremental, Granular, Encrypted and Compressed Exchange Mailboxes Backup
    • SharePoint, OneDrive & Teams BackupBackup Online site collections, Team sites, Office 365 groups, all documents etc.
    • Duplicate Remover - Office 365, Exchange & IMAP Remove duplicate emails, calendars, contacts, journal etc. from Office 365, Exchange & IMAP
    Go to products
  • Features
  • Video Tutorials
  • Free Tools
  • FAQ
  • Knowledge Base
  • Pricing
  • Download
  • Support
  • Sign in
  • Cart

Knowledge Base

Get an instant help and tips on how to use and get the most out of your EdbMails tools.

  • Video Tutorials
  • FAQ's
  • Support
  • Personalized Demo

How can we help you?

Search our Knowledge Base to quickly find answers to your questions.

Blog » Exchange Migration

Delete the contents of a user mailbox in Exchange and Microsoft 365

Problem:

You want to delete the mailbox contents of On-Premises Exchange and Exchange online user

Solution:

You can use PowerShell commands to delete the mailbox contents in Exchange Server 2019, 2016, 2013, 2010 or Exchange Online (Office 365). You must set the required permissions before you can run the cmdlets. Let’s understand how to:

  • Set the permissions to delete mailbox contents in the Exchange admin center
  • Set the permissions to delete mailbox contents using PowerShell
  • Delete mailbox contents in Exchange Online
  • Delete mailbox contents using Search-Mailbox (Exchange Online, Exchange 2019, Exchange 2016, Exchange 2013, Exchange 2010)

Set the permissions to delete mailbox contents in the Exchange admin center

On-Premises Exchange server

  1. Log in to the Exchange Admin Center
  2. Navigate through 'Permissions' > 'admin roles'

     Edit admin roles in Exchange Admin center

  3. Select 'Organization Management' and click the 'Edit (Pencil)' icon.

    Select Organization Management

  4. Click '+' under 'Roles'

    Edit the roles under Organization Management role group

  5. Select the following roles and add:
    • Mailbox Import Export
    • Mailbox Search

    Add Mailbox Import Export and Mailbox Search Role

  6. Click 'OK' and 'Save' the changes

Exchange Online (Microsoft 365)

Set the permissions to delete mailbox contents using PowerShell

Run the following command to assign the 'Mailbox Import Export' role :

New-ManagementRoleAssignment –Role "Mailbox Import Export" –User "username"

Here, 'username' is the User Principal Name (UPN).

You may have to reconnect to Exchange using PowerShell to reflect the permission changes. Either relaunch the PowerShell console, or use Disconnect-ExchangeOnline and Connect-ExchangeOnline again.

Delete mailbox contents in Exchange Online

Delete mailbox contents by using Search-Mailbox (Exchange Online, Exchange 2019, Exchange 2016, Exchange 2013, Exchange 2010)

The official support for this approach ended on July 1, 2020. However, you can use the Search-Mailbox cmdlet to delete the mailbox content in Exchange online, although the method is not officially supported. The item limit per mailbox is 10,000.

Click here to know the steps for Exchange migration using EdbMails

Click here to know the steps for Exchange Online (Office 365) migration using EdbMails

  1. Log in to the Exchange Admin Center
  2. Navigate 'Roles' > 'Admin roles' and click the 'Organization Management' from the role group list.

     Add admin roles to the Organization Management role group

  3. Select the 'Permissions' tab and choose the 'Mailbox Import Export' and 'Mailbox Search' roles

    Select Mailbox Import Export and Mailbox Search roles

  4. Click 'Save' and close the window
    1. Start a remote connection with your Exchange Online environment using PowerShell. You need to connect to the Security and Compliance Center for Exchange Online

      Connect-IPPSSession -UserPrincipalName <admin’s-UPN>

    2. Run the following command to search the mailbox contents and initiate the search

      New-ComplianceSearch -name <search-name> -ExchangeLocation <mailbox-name> | Start-ComplianceSearch

    3. Run the following command to verify the status of the Search

      Get-ComplianceSearch | FL name,items,size,jobprogress,status

    4. Run the following cmdlet to delete the mailbox contents

      New-ComplianceSearchAction -SearchName <search name> -purge

      Note that the New-ComplianceSearchAction can only delete 10 items at once from each mailbox. If you want to delete more items, you need to either use precision searching or repeat the process using a loop.

    1. Log in to the 'Exchange Management Shell'
    2. Run the following PowerShell command to verify the number of items that will be deleted:

      Search-Mailbox -Identity "<MailboxOrMailUserIdParameter>" -EstimateResultOnly

      Here,'MailboxOrMailUserIdParameter' can be an alias, canonical DN, display name, user principal name etc. Refer this Microsoft article for more details on the Search-Mailbox cmdlet.

    3. Run the following PowerShell command to delete the mailbox contents:

      Search-Mailbox -Identity "<MailboxOrMailUserIdParameter>" -DeleteContent -force

Related topics:

  • How to switch mailboxes to Office 365 in a Hybrid environment?
  • Target server mailbox addresses cannot be resolved
  • Solution for Invalid MIME content
  • Prerequisites for the Hybrid deployment
  • Troubleshooting Public Folder Migration
  • Perform Exchange Database Recovery without Exchange log files
  • Exchange Server Backup Pricing
  • Exchange Migration Pricing
  • Verify mailbox accessibility using EWS
  • The Exchange server version is invalid or is unavailable
hidden msg

EdbMails Demo / Trial Version

Step 1. Download and install EdbMails

Step 2. Click the 'Start Your Free Trial' button

Demo login EdbMails

  • Home
  • Features
  • Pricing
  • Support
  • Download
  • Sitemap
  • FAQ
  • Video Tutorials
  • Technical Support
  • Live Chat
  • Contact Us
Shifttocloud Inc.
Rehoboth Beach, DE
United States
+1 (302) 416-3056

Privacy Policy | Terms of Use | GDPR | Security | Press Releases

@edbmails.com All rights are reserved

Live Chat

Hi, May I help you?

Hide Chat Now