Microsoft Office 365Powershell

Bulk Assign Office 365 User Licenses with PowerShell: Step-by-Step Guide

Introduction:

Managing user licenses in Office 365 can be a time-consuming task, especially when dealing with multiple users. This guide will walk you through how to efficiently assign licenses to multiple users at once using PowerShell scripts, saving you valuable time and ensuring accurate license assignments.

We will utilize PowerShell, a powerful tool for automating tasks in Office 365 environments, to streamline the process of assigning user licenses.

Step-by-Step Instructions:

1: Connect to Office 365 PowerShell:

2: Prepare the License Sku:

Identify the license SKU you want to assign. You can list all available SKUs with:

Get-MsolAccountSku

3: Create a CSV File with User Information:

4: Assign Licenses to Users:

$Users = Import-Csv -Path "C:\Path\to\Your\File.csv"
foreach ($User in $Users) {
    Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -AddLicenses "TENANT:ENTERPRISEPACK"
}

5: Verify License Assignments:

To verify that the licenses have been assigned correctly, you can run:

Get-MsolUser | ft UserPrincipalName, Licenses

Helpful Tips:

  • Ensure that the CSV file is correctly formatted with the UserPrincipalName and LicenseAssignment columns.
  • Double-check the license SKU names before running the script to avoid errors.
  • Test the script with a small number of users first to ensure it works as expected.

Summary:

By following these steps, you can efficiently assign Office 365 user licenses in bulk using PowerShell scripts. This method not only saves time but also ensures accurate and consistent license assignments across multiple users. If you’re also interested in creating single or bulk users in Office 365, refer to this helpful guide: Effortless User Account Creation in Office 365 with PowerShell: Single & Bulk User Setup Guide. For further automation, consider exploring PowerShell scripts for other Office 365 management tasks.

Recommended For You:  Run Linux Virtual Machines on Hyper-V: A Comprehensive PowerShell Guide

Muhammad Faizan

Hi, My name is Muhammad Faizan and i have spent last 15 years working as System Administrator mainly with Microsoft Technologies. I am MCSE, MCTP, MCITP, certified professional. I love scripting and Powershell is the scripting language i am in love with.

Related Articles

Leave a Reply

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

Back to top button