Our community of experts have been thoroughly vetted for their expertise and industry experience.
Microsoft Exchange Server, Office 365 and Outlook expert with a penchant for tech forums. Looking forward to sharing skills and knowledge.
Published:
Browse All Articles > Use PowerShell to create and license users in bulk on Office 365
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
1. Connect to your Office 365 tenant with Powershell. (Learn more...)
2. Create a CSV file with users' details. The file should contain information such as users' email address (as UPN), first name, last name etc. Example contents of a file including headers:
The "$path" variable holds information about the location of your CSV file. Replace "c:\CSV_file_name.csv" with your own file path.
The "$server" variable holds information about your current license package name. Replace it with your own license name. To learn what license you have, you can use the following command (the name will be provided in the "AccountSkuId" column):
4. With the CSV file containing users' details ready you can now import it into Office 365 and create user accounts. To do so - use the following command:
The command loops trough each CSV entry and creates respective accounts.
It also sets the "usagelocation" parameter which is required later for license assignment. In this example "US" (United States) is used - you can change it to any ISO 3166 standard code (http://en.wikipedia.org/wiki/ISO_3166-1).
5. To enable users to receive and send emails, you need to assign them their licenses. The command is similar to the previous one:
Comments (0)