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
Enter the administrator user name and password for Office 365.
Second, see which Office 365 licenses are under the domain
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"
This article from "Abraham-xu" blog, reproduced please contact the author!
How to use PowerShell to bulk assign licenses to Office 365 users