×

Add Multiple Members & Create Bulk Distribution Groups in Office365 by using Hybrid Exchange Online PowerShell

Microsoft 365 portal doesn't offer you an easy way to create multiple Distribution Lists (DL) and add multiple members in a Distribution groups.We will show you how to create multiple DL and add multiple members in a DL by using hybrid Exchange PowerShell

Add Multiple Members & Create Bulk Distribution Groups in Office365 by using Hybrid Exchange Online PowerShell

Microsoft 365 portal doesn't offer you an easy way to create multiple Distribution Lists (DL) and add multiple members in a Distribution groups. We will show you how to create multiple DL and add multiple members in a DL by using hybrid Exchange PowerShell.

Generally, we create multiple DLs from the Office365 admin panel manually If you have a requirement to create a huge number of multiple DL groups and add multiple members in a Distribution List(DL) group for your organization then it would be a headache to do this task manually. To have a bulk multiple Distribution List (DL) and adding multiple members in a Distribution group is to use PowerShell.

In most of the cases we use our system Windows ISE PowerShell but Microsoft 365 updates their panel every 6 months so that sometimes our system Windows ISE PowerShell can not run the latest “PowerShell command” for this reason we suggest you to use Exchange hybrid online PowerShell module instead of using system Windows ISE PowerShell.

To install Exchange hybrid online PowerShell module requires the following steps:

Login to your Office 365 Admin Panel 

1.You must have access to the office 365 admin panel.

2.Open your Microsoft Edge or Internet Explorer Browser and Login to your Office 365 account at https://admin.microsoft.com/

Note:  Exchange hybrid online PowerShell module can only be installed from Microsoft Edge or Internet Explorer Browser.

3. Go to the Exchange-> open Classic Exchange admin center-> click on the hybrid-> Click on the 2nd Configure option of The Exchange Online PowerShell Module supports.

After installing the application it will display in your system desktop. Double click on the application and run the below commands as per your requirements.

1.Add Multiple Members in Distribution List(DL)

Create CSV file with following column header:

PrimarySmtpAddress

After Put the code Press ‘Enter’

While prompting for any, type [A] Yes to All and press Enter.

While asking ID password, put super admin ID and password

Code:

______________________________________________________________________

Set-ExecutionPolicy RemoteSigned

$UserCredential = Get-Credential

Connect-MsolService -Credential $UserCredential

Connect-EXOPSSession -UserPrincipalName demo@infiflexglobal.com

 Import-Csv "C:\Users\Infiflex125\Downloads\Test1 - Sheet1 - Test1 - Sheet1.csv" | foreach{Add-DistributionGroupMember -Identity "GroupName" -Member $_.PrimarySmtpAddress}

            *Put the admin id in green marking area after that it will ask for password*

            *Put the csv file path in yellow marking area*

           *Put the Distribution List Name in Blue marking area*    

2.To create bulk distribution groups at one time

Create CSV file with following column headers:

Name PrimarySmtpAddress,Type

Note: In the ‘Type’ column header you have to write Distribution & In the ‘Name’ column header you have to write Group Name.

After Put the code Press ‘Enter’      

While prompting for any, type [A] Yes to All and press Enter.

While asking for an ID password, enter a super admin ID and password.

Code:

____________________________________________________________________

Set-ExecutionPolicy RemoteSigned

$UserCredential = Get-Credential

Connect-MsolService -Credential $UserCredential

Connect-EXOPSSession -UserPrincipalName demo@infiflexglobal.com

Import-CSV "C:\Users\Infiflex125\Downloads\Test2 - Test1 - Sheet1.csv" | foreach {New-DistributionGroup -Name $_.name -PrimarySmtpAddress $_.PrimarySmtpAddress -Type $_.Type}

             *Put the admin id in green marking area after that it will ask for password*

             *Put the csv file path in yellow marking area*

After you finish these steps, go to the admin panel and you will see the changes.




Trendy