To add an individual mailbox user to a distribution group in PowerShell that has an owner already assigned, the command will look similar to this…
Add-DistributionGroupMember -Identity "DISTRIBUTION_GROUP_NAME" -Member "USER_ALIAS" -BypassSecurityGroupManagerCheck
To add multiple mailbox users to multiple distribution groups, we need to make a CSV file (C:\DistroMembers.csv for this example). The CSV file should contain a row for every distribution group that each mailbox user is being added to because the Add-DistributionGroupMember command only allows one user (member) to be assigned at a time.
Given that, the CSV should look similar this, with Alias and DistributionGroup as the column headers…
Alias,DistributionGroup JDoe,Human Resources JDoe,Management JSmith,IT JSmith,Executives
The command should look similar to this…
Import-Csv "C:\DistroMembers.csv" | ForEach-Object { Add-DistributionGroupMember -Identity $_.DistributionGroup -Member $_.Alias -BypassSecurityGroupManagerCheck }
Pingback: Distribution Group and Powershell – SomaBright