First, create a CSV with a list of users and a heading like "EmailAddress". This heading will be used in the PowerShell command later.
**Note** I tend to use email addresses because they're usually more constant than things like usernames, which can be in different formats depending on how many migrations/acquisitions you go through.
You can use Notepad or Excel to build the CSV, and they'll look like this:
Fire up the Exchange Management Shell (EMS) and cd to the location of your CSV:
cd C:\Temp
Then run:
Import-CSV "BulkDistroGroupMembers.csv" | ForEach {Add-DistributionGroupMember -Identity "Distribution Group Name" -Member $_.EmailAddress}
**Note** Change "Distribution Group Name" to the distro group you are adding members to. $_.EmailAddress will correspond to your heading in the CSV. You can name the heading what you like, just make sure that the -Member value matches the heading.
Now your distribution group will quickly have a ton of members.
It did not work
ReplyDeleteI pasted the script
Import-CSV "addmem1.csv" | ForEach {Add-DistributionGroupMember -Identity "DG New Set" -Member $_.EmailAddresses}
The result was
Add-DistributionGroupMember is not recognized as the name of a cmdlet, function, script file, or operable program.
Are you running the cmdlet in the Exchange Management Shell or AD PowerShell? It needs to be run in the EMS, unless you add the Exchange snap-in.
DeleteAnd, is the account you're using a member of the Recipient Management RBAC group?
Worked great for me thanks
ReplyDeletethanks~~
ReplyDeleteThank you
ReplyDelete