Add Shared and Resource Mailboxes to Office 365 in Bulk with PowerShell

I had a project recently where we were migrating from hosted Exchange to Office 365. We implemented AAD Connect to sync Active Directory (AD) user objects for the user mailboxes that where being migrated. However, we manually created shared and resource mailboxes, groups, and contacts in O365 as those were not going to be created in AD for synchronization.

For this article, we will add shared and resource mailboxes to Office 365 in bulk with PowerShell using a CSV file.

The command we will use for this task is New-Mailbox. For New-Mailbox we will basically utilize only 3 parameters to create our mailboxes; Name, Alias, and Equipment / Room / Shared (based on the mailbox type being created).

We will create our a CSV file for each mailbox type similar to the following (MyO365SharedMailboxes.csv, MyO365RoomMailboxes.csv, MyO365EquipmentMailboxes.csv) which I saved in the C:\Scripts directory.

Add Mailboxes 1

 

Now that we have our CSV files set, we need to connect to Office 365 with PowerShell.

Once connected to the O365 tenant, we will run the following commands to add each specific mailbox types from the CSV files…

Shared Mailboxes

Import-Csv "C:\Scripts\MyO365SharedMailboxes.csv" | foreach-object { New-Mailbox -Name $_.MyName -Alias $_.MyAlias -Shared }

Add Mailboxes 2

Add Mailboxes 3

 

Room Mailboxes

Import-Csv "C:\Scripts\MyO365RoomMailboxes.csv" | foreach-object { New-Mailbox -Name $_.MyName -Alias $_.MyAlias -Room }

Add Mailboxes 4

 

Equipment Mailboxes

Import-Csv "C:\Scripts\MyO365EquipmentMailboxes.csv" | foreach-object { New-Mailbox -Name $_.MyName -Alias $_.MyAlias -Equipment }

Add Mailboxes 5

Add Mailboxes 6

 

 

Reference(s):

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s