Skip to content

How to create Office 365 Users using PowerShell

How to create Office 365 Users using PowerShell

In this post, I will look at how we can create new Office 365 Users using PowerShell and look at how we can create bulk Office 365 users using a PowerShell script.

To get started we need to connect to Office 365 using PowerShell. This can be done using the following method.

Once the Credentials has been specified run the following cmdlet.

Now that we have the connection established, let’s go ahead and create a single user by running the following cmdlet.

The following example will create the New account and assign an E3 license to the user.

The user account will be created with an auto generated password and will be listed as below.

Now that we have an idea of how to create one user using PowerShell, let’s go ahead and create multiple user using PowerShell with a CSV file.

To get started we first need to create our CSV file, the following headings will be used for the CSV.

Now let’s complete the CSV by adding some users.

Now let’s look at what the PowerShell Script will look like.

For all the users, I will not specify any password and will leave this to Office 365 to auto generate the passwords. In the script, the Export-CSV has been specified as well so we can review the results after the script has completed.

Let’s verify the users we just created now by running the following.

Note: I have added the Where-Object just so that I can see the accounts which I have created during this script.

If you reference the Output File you will get all the passwords which was auto generated during the creation process.

The Script and CSV file can be downloaded here. O365


Sharing is caring!

Published inAzureExchange OnlineOffice 365PowerShell

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *