Save time when creating and adding members to Office 365 distribution groups by CSV with scripts.

When you’re creating and adding members to Office 365 distribution groups by CSV in Office 365, it can be very time consuming to go one by one. Using the scripts below can help you save time and frustration when creating and adding members to distribution groups by CSV.

Scenario:

An organization is migrating from another email environment and would like to create their distribution groups on Office 365.

Solution:

1. Create Distribution Groups

Import-CSV “C:\temp\distgroups.csv” | foreach {New-DistributionGroup -Name $_.name  -PrimarySmtpAddress $_.PrimaryEmail -Type $_.Type}

2>> c:\temp\FileNameLogs.txt

Screen Shot Of CSV Example:

2. Add Members to Distribution Group

Import-Csv “C:\temp\neurogroupmembers.csv” | foreach{Add-DistributionGroupMember -Identity $_.identity -Member $_.members}

Example Of CSV:

Make sure that the members have the identity next to it ” NAME OF THE DG THEY ARE GOING TO BE A MEMBER OF “

Use these scripts to save time and frustration when creating and adding members to Office 365 distribution groups by CSV.  For more MessageOps Tech Tips to improve your Office 365 experience, click here.

Was this article helpful?
YesNo