Create Security Group & Mail Enable using PowerShell

  • Last update on January 25th, 2024

Table of Contents

If you are looking for a way to create an on-premise mail-enable local security group, you can use the following:

In PowerShell:

New-DistributionGroup -Type Security -Name <UniqueName> [-IgnoreNamingPolicy] [-Alias <Alias>] [-DisplayName "<DisplayName>"] [-Notes "<Description>"] [-OrganizationalUnit <OU>] [-ManagedBy "<owner1>","<owner2>"...] [-Members "<member1>","<member2>"...] [-CopyOwnerToMember] [-MemberJoinRestriction <Closed | ApprovalRequired>] [-RequireSenderAuthenticationEnabled <$true | $false>]

In Coreview:

{
 "id": "6cd0cee8-208a-47bf-acb7-5e0e09e829a1",
 "title": "AD - Create mail-enabled security group",
 "description": "Create an on-premises security group and then mail-enable it",
 "lastModified": "2022-06-09T07:37:49.3370000Z",
 "target": "None",
 "tags": [],
 "vars": [
 {
 "name": "GroupName",
 "type": "string",
 "isRequired": true
 }
 ],
 "params": [],
 "columns": {},
 "version": 3,
 "statement": "param ([string]$GroupName)\r\n\r\nNew-ADGroup -Name $GroupName -GroupCategory Security -GroupScope Universal\nEnable-DistributionGroup $GroupName"
}