"You don't have sufficient permissions" error when trying to delete a distribution group
Description
When you issue a "Remove-DistributionGroup -Identity whatever" command, you get the following error:
PS C:\kobi> Remove-DistributionGroup -Identity whatever
You don't have sufficient permissions. This operation can only be performed by a manager of the group.
+ CategoryInfo : NotSpecified: (:) [Remove-DistributionGroup], OperationRequiresGroupManagerException
+ FullyQualifiedErrorId : 98E71785,Microsoft.Exchange.Management.RecipientTasks.RemoveDistributionGroup
Solution
Use the -BypassSecurityGroupManagerCheck paremeter to force the deletion.
PS C:\kobi> Remove-DistributionGroup -Identity whatever -BypassSecurityGroupManagerCheck
Confirm
Are you sure you want to perform this action?
Removing distribution group "Whatever" will remove the Active Directory group object.
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): y
Affected software:
Microsoft Exchange 2010
Microsoft Exchange 2010 SP1
Microsoft Exchange 2010 SP2
Office 365 RTM