Back to script samples page
Adding an user to a Distribution group

Use the Add-DistributionGroupMember command to add a recipient to a distribution group.

#Adding an user to a Distribution group.

#Capture administrative credential for future connections.
$credential = get-credential

#Creates an Exchange Online session
$ExchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $credential -Authentication Basic -AllowRedirection

#Import session commands
Import-PSSession $ExchangeSession 

#This command adds the user user@contoso.com the distribution group DistributionGroupName. Replace DistributionGroupName with the name of the Distribution Group you want to modify and user@contoso.com with the recipient you want to add. 
Add-DistributionGroupMember -Identity "DistributionGroupName" -Member "user@contoso.com"
Downloaded 0 times
- - - - - (0)
Comments