Home » Office 365 » Remove-MsolGroup – Remove a Group from Office 365

Remove-MsolGroup – Remove a Group from Office 365

The Remove-MsolGroup cmdlet in PowerShell removes a group from Microsoft Office 365.

The syntax to delete a group from Azure Active Directory is given below.

Remove-MsolGroup
      -ObjectId <Guid>
      [-Force]
      [-TenantId <Guid>]
      [<CommonParameters>]

In this article, we will discuss how to use the Remove-MsolGroup cmdlet in Powershell to remove a security group from the Azure Active Directory.

How to Remove a Security Group From Office 365

To remove a security group from Office 365, use the Remove-MsolGroup cmdlet in PowerShell with the -ObjectId parameter.

The -ObjectId parameter specifies the unique ID of the group to remove.

# Get the security group
$GroupId = Get-MsolGroup -SearchString "LabView"

# Remove a security group
Remove-MsolGroup -objectid $GroupId.ObjectId

The Get-MsolGroup cmdlet in PowerShell uses the -SearchString parameter to search the group and store the group information in the $GroupId variable.

The Remove-MsolGroup command uses the -ObjectId parameter to specify the group ID and removes the group in the $GroupId.

Conclusion

I hope the above article on how to use the Remove-MsolGroup cmdlet in PowerShell to remove a security group from Office 365 is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Get-MsolGroup

Set-MsolGroup

New-MsolGroup