Hi @Anonymous ,
You could refer to the following commands to create / remove a mail-enabled security group:
New-DistributionGroup -Name "File Server Managers" -Alias fsadmin -Type security
Remove-DistributionGroup -Identity " File Server Managers "
Then you could refer to the following command to verity that you've successfully created a mail-enabled security group:
Get-DistributionGroup <Name> | Format-List Name,RecipientTypeDetails,PrimarySmtpAddress
More information for your reference:
Manage mail-enabled security groups in Exchange Online | Microsoft Learn
New-DistributionGroup (ExchangePowerShell) | Microsoft Learn
Remove-DistributionGroup (ExchangePowerShell) | Microsoft Learn
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.