Bulk activation of users in Office365

I recently had to activate 2000 Exchange Online P1 users and 100 Office365 E4 Users.

So how can we do this quickly?

Powershell to the rescue.

Ensure that the Windows Azure Active Directory Module for Windows PowerShell is installed. Launch the module and run the following commands.You can download the module HERE

I need a CSV file for Exchange Online Plan 1 users and Office365 E4 users. To do this I run the following powershell commands to export all unlicensed users to a csv file.

Get-MsolUser -all | where {$_.isLicensed -eq $false} | select-object userprincipalname | out-file c:\users.csv

I can then review the contents of this csv file and create two csv files.

Exchange Online Plan 1 users : p1.csv
Office365 E4 users : e4.csv

Connect-MsolService (Enter Global Administrator credentials)
Get-MsolAccountSku (Take note of the account skus)

Assign a usage location to each set of users with the following powershell commands. The usage location in this example is Ireland IE

Import-Csv -Path c:\P1.CSV | foreach {set-MsolUser -UserPrincipalName $_.UPN -UsageLocation IE} 

Import-Csv -Path c:\E4.CSV | foreach {set-MsolUser -UserPrincipalName $_.UPN -UsageLocation IE} 

Then assign a license to each set of users.

Import-Csv -Path c:\P1.CSV| Set-MsolUserLicense -UserPrincipalName {$_.’UPN’} –AddLicenses “Contoso:EXCHANGESTANDARD” 

Import-Csv -Path c:\E4.CSV| Set-MsolUserLicense -UserPrincipalName {$_.’UPN’} –AddLicenses “Contoso:ENTERPRISEWITHSCAL” 

And there we go all users activated.


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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s