Effortless User Account Creation in Office 365 with PowerShell: Single & Bulk User Setup Guide
Table of Contents
Introduction
If you manage user accounts in Office 365, PowerShell can be your best friend. This guide will walk you through creating both single and multiple user accounts in Office 365 using PowerShell. By the end, you’ll be a pro at efficiently handling user management in your Office 365 environment.
Target Audience
IT administrators with some PowerShell experience
Step-by-Step Instructions
Step 1: Accessing PowerShell
- Find PowerShell on your system (usually in the Start menu).
- Right-click on PowerShell and select “Run as administrator.”
Step 2: Connect to Office 365
Run these commands in your PowerShell window:
$UserCredential = Get-Credential
Connect-MsolService -Credential $UserCredential
You’ll be prompted to enter your Office 365 admin credentials.
Single Account Creation
Step 3: Create a Single User Account
Use this PowerShell script, replacing the placeholders with the new user’s details:
New-MsolUser -UserPrincipalName [email protected] -DisplayName "User Name" -FirstName "First" -LastName "Last" -Password "Password" -LicenseAssignment "Enter-License-SKU"
Multiple Account Creation from CSV
Step 3: Prepare CSV File
- Create a CSV with these column headers: UserPrincipalName, DisplayName, FirstName, LastName, Password, LicenseAssignment.
- Add a row for each user, filling in their details correctly.
Step 4: Bulk Create User Accounts
Run this PowerShell script (make sure to replace the CSV path):
$UserList = Import-Csv C:\Path\to\CSV\File.csv
foreach ($User in $UserList) {
New-MsolUser -UserPrincipalName $User.UserPrincipalName -DisplayName $User.DisplayName -FirstName $User.FirstName -LastName $User.LastName -Password $User.Password -LicenseAssignment $User.LicenseAssignment
}
Helpful Tips
- Double-check your CSV! Errors there will mess up the bulk creation.
- Know your license SKUs. You’ll need them for assigning licenses.
Summary
Effortlessly create user accounts in Office 365 using PowerShell, whether setting up a single user or multiple users from a CSV file. This guide empowers you to efficiently manage user accounts within your Office 365 environment. For further insights on managing user licenses, refer to our article “Bulk Assign Office 365 User Licenses with PowerShell: Step-by-Step Guide.