Create Multiple Mail Contacts On Exchange Online Using PowerShell

In this blog post, I’ll show you how to create multiple mail Contacts In Office 365 Exchange Online.

In my case I had to create 100 mail contacts for External partners and creating them using the Portal would take minimum one hour.

With the help of PowerShell and Exchange Online PowerShell module, the task took less than 3 minutes.

Create CSV

The first step in the process is to create a .CSV file with the format below:

Name, ExternalEmailAddress, alias

User 02, User02@emailaddress.com, user02

User 03, User03@emailaddress.com, user03

Run the Script

Next, Connect to Exchange Online and run the line below with the .CSV file

import-csv .\MailContacts.csv | foreach {New-MailContact -Name $_.name -ExternalEmailAddress $_.externalemailaddress -Alias $_.alias }

Once done all mail contacts will be created in Exchange Online and will be visible in the Address Book.


Posted

in

by