How to remove mailboxes from Exchange Online

This article lists the steps to use PowerShell to delete mailboxes from Exchange Online or Office 365 and also compares it with ADManager Plus, a unified Active Directory, Office 365 and Exchange management and reporting tool, to demonstrate why PowerShell is complex.

Windows PowerShell

Steps to use PowerShell to delete Exchange Online mailbox.

  • Ensure you have the necessary permissions to delete the mailbox.
  • Get the name of the user account to which this mailbox belongs, and also decide if you wish to delete the mailbox permanently right away.
  • Create the script with these values.
  • Execute the script in the PowerShell window.

A sample script to remove mailbox from Exchange Online using PowerShell

 Copied
Remove-Mailbox -Identity "John Smith"
Click to copy entire script

ADManager Plus

To delete an Exchange Online mailbox,

  • Select the Delete Users option from User Management in Office 365 tab.
  • Select the Office 365 tenant in which the user account to which the mailbox to be deleted resides, enter the user name or fetch the list from a CSV file, and click Apply.
  • This will delete the Office 365 user account and also the associated Exchange Online mailbox.

Screenshot

Remove User Mailbox from Exchange Online using ADManager Plus

» Start 30-day Free Trial

The script used above shows to use PowerShell to delete mailbox in Exchange Online. If you wish to use PowerShell to delete mailboxes from CSV in bulk, you cannot use the same script.

Limitations of using PowerShell to Remove Mailboxes from Exchange Online

  • To delete an Exchange Online mailbox, you must have the necessary permissions. With ADManager Plus, users privileges in native AD or Exchange doesn't have to be elevated, and they can be allowed to do this operation only in specific OUs or domains.
  • To bulk delete Exchange Online mailboxes, the script has to be modified. With ADManager Plus though, it is offered as a built-in option that's available by default.
  • You must know how to execute the scripts from the PowerShell window or command line. ADManager Plus is purely GUI-based, allowing you to perform all management and reporting actions with just mouse clicks from its web-based console.
  • Even a misplaced hyphen, a typo in the LDAP names or lack of sufficient permissions will lead to errors. As all actions in ADManager Plus are GUI-driven, there is no need to write scripts, eliminating the chances of errors.
  • Embark on your script-free AD management, reporting, and automation journey with ADManager Plus.
  •  
  • By clicking 'Start your free trial now', you agree to processing of personal data according to the Privacy Policy.
  • Thanks
  • Your download should begin automatically in 15 seconds. If not, click here to download manually.

Related Powershell How-to Guides:

Email Download Link