Sündmused
Microsoft 365 kogukonnakonverents
6. mai, 14 - 9. mai, 00
Oskused tehteajamise ajastuks parimal kogukonna juhitud Microsoft 365 üritusel, 6.–8. mail Las Vegases.
LisateaveSeda brauserit enam ei toetata.
Uusimate funktsioonide, turbevärskenduste ja tehnilise toe kasutamiseks võtke kasutusele Microsoft Edge.
This article applies to both Microsoft 365 Enterprise and Office 365 Enterprise.
Märkus
Learn how to remove licenses from user accounts with the Microsoft 365 admin center. For a list of additional resources, see Manage users and groups.
First, connect to your Microsoft 365 tenant.
Assigning and removing licenses for a user requires the User.ReadWrite.All permission scope or one of the other permissions listed in the 'Assign license' Graph API reference page.
The Organization.Read.All permission scope is required to read the licenses available in the tenant.
Connect-Graph -Scopes User.ReadWrite.All, Organization.Read.All
To view the licensing plan information in your organization, see the following articles:
To remove licenses from an existing user account, use the following syntax:
Set-MgUserLicense -UserId "<Account>" -RemoveLicenses @("<AccountSkuId1>") -AddLicenses @{}
This example removes the SPE_E5 (Microsoft 365 E5) licensing plan from the user BelindaN@litwareinc.com:
$e5Sku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'SPE_E5'
Set-MgUserLicense -UserId "belindan@litwareinc.com" -RemoveLicenses @($e5Sku.SkuId) -AddLicenses @{}
To remove all licenses from a group of existing licensed users, use the following syntax:
$licensedUsers = Get-MgUser -Filter 'assignedLicenses/$count ne 0' `
-ConsistencyLevel eventual -CountVariable licensedUserCount -All `
-Select UserPrincipalName,DisplayName,AssignedLicenses
foreach($user in $licensedUsers)
{
$licensesToRemove = $user.AssignedLicenses | Select -ExpandProperty SkuId
$user = Set-MgUserLicense -UserId $user.UserPrincipalName -RemoveLicenses $licensesToRemove -AddLicenses @{}
}
To remove a specific license from a list of users in a CSV
file, perform the following steps. This example removes the SPE_E5 (Microsoft 365 Enterprise E5) license from the user accounts defined in the CSV
file C:\My Documents\Accounts.csv.
Create and save a CSV file to C:\My Documents\Accounts.csv that contains one account on each line under the UserPrincipalName
header like this:
UserPrincipalName
akol@contoso.com
tjohnston@contoso.com
kakers@contoso.com
Use the following command:
$usersList = Import-CSV -Path "C:\My Documents\Accounts.csv"
$e5Sku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'SPE_E5'
foreach($user in $usersList) {
Set-MgUserLicense -UserId $user.UserPrincipalName -RemoveLicenses @($e5Sku.SkuId) -AddLicenses @{}
}
Another way to free up a license is by deleting the user account. For more information, see Delete and restore user accounts with PowerShell.
Manage Microsoft 365 user accounts, licenses, and groups with PowerShell
Sündmused
Microsoft 365 kogukonnakonverents
6. mai, 14 - 9. mai, 00
Oskused tehteajamise ajastuks parimal kogukonna juhitud Microsoft 365 üritusel, 6.–8. mail Las Vegases.
LisateaveKoolitus
Moodul
Manage users, groups, and licenses in Microsoft Entra ID by using Windows PowerShell - Training
This module covers how to give access to the services in Microsoft 365, so that you can create user accounts and then assign licenses that provide access to the services.
Sertimine
Microsoft 365 Certified: Administrator Expert - Certifications
If you’re an administrator who deploys and manages Microsoft 365 and performs Microsoft 365 tenant-level implementation and administration of cloud and hybrid environments, this certification is designed for you.
Dokumentatsioon
Assign Microsoft 365 licenses to user accounts with PowerShell - Microsoft 365 Enterprise
In this article, learn how to use PowerShell to assign a Microsoft 365 license to unlicensed users.
View Microsoft 365 account license and service details with PowerShell - Microsoft 365 Enterprise
Explains how to use PowerShell to determine the Microsoft 365 services that have been assigned to users.
View licensed and unlicensed Microsoft 365 users with PowerShell - Microsoft 365 Enterprise
This article explains how to use PowerShell to view licensed and unlicensed Microsoft 365 user accounts.