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 -Credential $credential -Authentication Basic -AllowRedirection

#Import session commands
Import-PSSession $ExchangeSession 

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