Sylver SCHORGEN Blog's

Articles, astuces et news sur les technologies Microsoft et plus particulièrement tournant autour de Powershell

Hello,

Here is a little PowerShell tip on how to create an Exchange Online Distribution Group with PowerShell. The cmdlet I will use is New-DistributionGroup with the following parameters : 

  • Name : Unique value used for the name of the group. The maximum length is 64 characters. This value will be used as well if you don't use the DisplayName parameter
  • Alias : Parameter used to specify the Exchange alias for the recipient. If you create a distribution group without specifying the primary email address, the alias will be used (<alias> @ <domain>). If you don't specify this parameter, the value of the Name parameter will be used (without the spaces and unsupported characters)
  • ManagedBy : Parameter used to specify the group owner. If you don't specify a user account here, the user account creating the group (via PowerShell) will be used
  • MemberDepartRestriction : Parameter used to specify the restrictions on users requests to leave the distribution group. There are 2 values possible :
    • Open : The members can leave the distribution group when they want to without any approval
    • Closed : The members can't remove themselves from the distribution group and the requests are automatically rejected. The membership is managed by the group owner(s)
  • MemberJoinRestriction : Parameter used to specify the restriction on users requests to join the distribution group. There are 3 values possible :
    • OpenThe members can add themselves to the distribution group when they want to without any approval
    • ClosedThe members can't add themselves to the distribution group and the requests are automatically rejected. The membership is managed by the group owner(s)
    • ApprovalRequiredThe members can request to join the distribution group. The request is submitted for approval to the group owner(s). The user will only be in the distribution group after approval
  • Members : Parameter used to specify the recipients that are members of the distribution group. You must use a value that uniquely identifies the recipient like the Name, DisplayName, Alias, DN, Canonical DN, Email address or GUID. If you wan to specify multiple members, separate them with a coma (user1, user2, user3)
  • PrimarySMTPAddress : Parameter used to specify the primary email address of your distribution group
  • RequireSenderAuthenticationEnabled : Parameter used to specify if you want to accept only messages from your organization (internal) or from anyone (internal and external).

The PowerShell syntax I use to create a distribution group with MemberDepartRestriction set to ClosedMemberJoinRestriction set to Closed and RequireSenderAuthenticationEnabled set to $false

New-DistributionGroup -Name "Demo Sylver" -Alias "DemoSylver" -ManagedBy "Sylver" -MemberDepartRestriction "Closed" -MemberJoinRestriction "Closed" -Members "John","Paul" -PrimarySmtpAddress "demosylver@mydomain.com" -RequireSenderAuthenticationEnabled $false

 
Facebook Like