Bulk Assign Office 365 Licenses via PowerShell Commands on Windows OS
The post is going to brief readers with a solution to create and license users in bulk on Microsoft Office 365 through PowerShell commands. This is a stepwise guide to perform each and every step in a patient manner & assign licenses to Office 365 users in bulk.
“We are having an Office 365 education plus for faculty license allocated to our staff. A few months ago, we deactivated Teams for our employees through PowerShell commands. Now we want to turn on and again desire to bulk assign Office 365 licenses via PowerShell cmdlets. We tried to execute a script on our own but, it was of no use. Can anyone help us out by providing a workable solution to assign Office 365 licenses with PowerShell?”
Alike above, there are several business customers in educational, healthcare, IT, financial, etc., domain who ask for a solution to create and license O365 users in bulk. Therefore, here are we with this webpage to assist Microsoft administrators with the same.
Solution to Bulk Assign Licenses office 365 Using PowerShell
1. Take help of following instructions to connect your Office 365 account with PowerShell :
a) Execute ‘Import-Modul MSOnline’ command in PowerShell window to import a relevant set of cmdlets.
b) Collect your targeted Office 365 username and password by running ‘$365Logon = get-credential’ command
c) Configure the remote session variables of PowerShell using the following cmdlet :
d) Start establishing the connection by running the following command :
e) If you are facing any runtime error at this stage then it means that the script execution policy is disabled. To enable the same, you have to execute ‘Set-ExecutionPolicy RemoteSigned’ command in PowerShell
f) Last comes to the execution of the following command to generate a connection with O365 online service. This will finish first major step to assign custom Office 365 licenses via PowerShell
2. When you are done with the successful connection between Office 365 and PowerShell window, create a CSV file. The use of CSV file is to create the bulk of users whose licenses is to activate. This .csv file should be having information like users’ email id (as UPN), first name, last name, etc. For example – File should contain data along with headers as mentioned in the following screenshot :
Note – On first login time, users will be asked to change their passwords.
3. You can make use of following variables for simplifying the procedure :
In the mentioned commands, $path attribute holds the information associated with the path of CSV file. You have to replace ‘c:\CSV_file_name.csv’ location with your CSV file path on your machine. Next comes $server attribute that maintains the record of your recent license package name. You have to replace it with name of your license. If you are unaware from name of your license, use ‘Get-MsolAccountSku | out-gridview’ command to extract the same. Continue the procedure to assign Office 365 licenses with PowerShell by importing this newly created CSV file.
4. After making CSV file ready with user details, you are at the stage of importing the file in Office 365 tenant and then the creation of user accounts. For this, type and execute the following command in PowerShell :
usagelocation parameter whose work is at the time of license assignment. For example – In the posted command, ‘US’ is mentioned that can be changed by you to any of the ISO 3166 standard code.
5. It is the time to bulk assign Office 365 licenses via PowerShell for enabling users with exchange of messages. Well, the command line is somewhat similar like the previous one.
6. Finally now are done with the entire procedure from your end. You can check the status of your license assignment with help of following code :
After executing this command line, you will see a separate window with a complete list of O365 created and licensed users.
Observational Verdict
The blog describes each and every step to bulk assign Office 365 licenses via PowerShell. Administrators can execute the commands one-by-one in PowerShell window. However if one is facing problems while achieving O365 license in bulk through PowerShell command then, they can contact to our support team. Our team of MS Exchange experts will get in touch with you and try their best in resolving your problem.