Rapid Office 365 User Creation Using PowerShell

Office 365


MFA Keys


When performing a migration from your existing on-premise Exchange installation or other email service the creation of all your users and their proper settings can be a time consuming task within the Office 365 GUI. And YES, it is a much quicker process that using that old USR 28.8/33.6 modem pictured above on your 1990’s dial-up ISP.

This guide will show you how to quickly create all your mailboxes using a CSV file and a PowerShell command.

Overview of the Process

Before you can begin the bulk user creation, you need to complete several tasks:

  1. Set up an Office 365 account
  2. Assemble a CSV file that contains the user names and all the user-specific information
  3. Log in to Office 365 with PowerShell and run the mailbox creation command

Office 365 Account Setup

This step should be fairly self-explanatory. Just create an Office 365 account at http://office365.com. A trial account will work for up to 25 users. You’ll need to make some slight DNS changes to prove ownership of your domain but Microsoft’s site will walk you through it.

Create the CSV File

The easiest option is to use any version of Excel to create a CSV file that you can use to import all the users. The screenshot below is for three users– you’ll almost certainly have more users to create so just keep replicating the format on additional lines.

20151119-001 Rapid Office 365 User Creation

Creating the Mailboxes with PowerShell

Before performing the import, the next step is to log in to PowerShell. We’ve written a guide for that too in a previous article!

Note that there are two file CSV paths in the command below – one for input and one for output. Adjust those to the locations where you have your input file and where you want the results to be saved. The command is all on one line within PowerShell.

Import-Csv -Path D:Office365AccountCreation.csv | ForEach-Object {New-MsolUser
–Department $_.Department -FirstName $_.FirstName -DisplayName $_.DisplayName
-LastName $_.LastName -Password $_.Password -UserPrincipalName $_.UserPrincipalName
-UsageLocation $_.UsageLocation}| Export-Csv –Path D:Office365ImportResults.csv

You won’t get a response from PowerShell after running the command unless there is an error. This is what a successful process looks like:

20151119-002 Rapid Office 365 User Creation

You can then check in the Office 365 Admin web interface to make sure the users have been created:

20151119-003 Rapid Office 365 User Creation

An alternative method to list all of your users via PowerShell is detailed in another of our previous articles.

By |2015-11-19|Office 365|