How to use PowerShell to bulk assign licenses to Office 365 users

Source: Internet
Author: User

Recently a customer asked, using ad synchronization, to create a batch of hundreds of users for Office 365, who need to manually assign licenses to them on the web side?

----------------------------------------------------

Assigning licenses to users one at a time in the Administrator Portal page is a method, but the workload of mechanical labor can be large when the user volume is large. This article recommends a method for bulk allocation of licenses using PowerShell.


The first step is to have PowerShell connect to Office 365


Import-module Msoline

Connect-msolservice

Enter the administrator user name and password for Office 365.


Second, see which Office 365 licenses are under the domain


Get-msolaccountsku

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/91/CA/wKioL1j4ZNSjZO9uAAAsG7ci_lk919.png "title=" Accountskuid.png "alt=" Wkiol1j4znsjzo9uaaasg7ci_lk919.png "/>

There are two types of licenses under this domain, and teckwah0 is the name of the domain.

Teckwah0:enterprisepack_no_rms: Refers to the Office 365 Enterprise E3 license under the Teckwah0 domain

Teckwah0:o365_business_premium: Refers to the commercial premium license under the Teckwah0 domain


Step three, assign licenses by department

Get-msoluser-department Sales-unlicensedusersonly | Set-msoluserlicense-addlicenses "Teckwah0:enterprisepack_no_rms"

Assign the Enterprise Edition E3 license to all users who are not assigned licenses in the sales department.


Before and after effects such as (note islicensed This field changes before and after):

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/91/CB/wKioL1j4ZebyZuDEAACrelugA0s417.png "title=" Assign license commands and effects. png "alt=" Wkiol1j4zebyzudeaacreluga0s417.png "/>


There are a lot of filtering rules for users, which are filtered by department and distributed uniformly, or by job, country, city, etc.

If there is only one license under the customer's domain, then we can also not filter and assign the same license to all users directly. The PowerShell command is as follows

get-msoluser-all-unlicensedusersonly | Set-msoluserlicense-addlicenses "Teckwah0:enterprisepack_no_rms"


Complete.

This article from "Abraham-xu" blog, reproduced please contact the author!

How to use PowerShell to bulk assign licenses to Office 365 users

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.