The best Microsoft 365 tips on the web

How to remove a Office 365 group or distribution group with PowerShell

As an administrator of Office 365 you have probably had to deal with removing groups or distribution groups within your organization. Perhaps it was because you wanted to overhaul the structure of your organization, clean up old projects or simply create a more efficient system. Whatever your reason, manually deleting groups can be time-consuming and tedious, especially if you are dealing with a large number of groups. But don't worry, PowerShell is here to help you!

What is PowerShell?

PowerShell is a command-line interpreter and environment developed by Microsoft for configuring and managing systems. Based on the .NET Framework, it provides a comprehensive set of cmdlets (command-line tools) for performing a wide variety of tasks, such as managing user accounts, installing software and managing network configurations. PowerShell is part of several Microsoft products, including Windows and Office 365, and can be used by system administrators and other advanced users.

What is a distribution group in Microsoft 365?

A distribution group in Office 365 is a group of users that you can use to send e-mails to a group of people without having to select each person individually. This can be useful if you regularly send e-mails to the same group of people, such as a project group or a team.

Deleting a Office 365 group through the admincenter

Browse go to https://admin.microsoft.com - Select left at Teams & Groups -> Active Teams and groups

Select the team you wish to delete -> press delete

Delete a Office 365 group through the Exchange Control Panel

Browse to the Exchange Control Panel: http://outlook.office.com/ecp

Select groups and delete the Office 365 group.

Login at PowerShell Azure AD

Tutorial: How to install Azure AD preview module with PowerShell

Open Powershell as administrator

Install the PowerShell module from Azure AD

Run the following line in PowerShell:

install-package -Name AzureAD

Connect to AzureAD via PowerShell


Retrieve all deleted Office 365 groups

Through this command you can retrieve all Office 365 groups:


Delete a Office 365 Group with Powershell - hard delete

Copy the ID after the get command and place ddit after -ID as in the screenshot below.

'Remove-AzureADMSDeletedDirectoryObject -Id 199e5c7....'

Also read

Getting Started Powershell for managing Microsoft 365
How to manage Microsoft Teams with Azure Cloud Shell
Tutorial: How to create and manage Microsoft Teams via PowerShell?

Tagged: , ,
0 0 vote
Article review
Please let us know if there are

Inline feedbacks
See all comments
Would love to know your thoughts, please leave a comment.x