


ConsistencyLevel eventual -CountVariable licensedUserCount -All ` Set-MgUserLicense -UserId -RemoveLicenses -AddLicenses remove all licenses from a group of existing licensed users, use the following syntax: $licensedUsers = Get-MgUser -Filter 'assignedLicenses/$count ne 0' ` To remove licenses from an existing user account, use the following syntax: Set-MgUserLicense -UserId "" -RemoveLicenses -AddLicenses example removes the SPE_E5 (Microsoft 365 E5) licensing plan from the user $e5Sku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'SPE_E5' View account license and service details with PowerShell View licenses and services with PowerShell To view the licensing plan information in your organization, see the following topics: The permission scope is required to read the licenses available in the tenant. Use the Microsoft Graph PowerShell SDKįirst, connect to your Microsoft 365 tenant.Īssigning and removing licenses for a user requires the permission scope or one of the other permissions listed in the 'Assign license' Graph API reference page. For a list of additional resources, see Manage users and groups. Learn how to remove licenses from user accounts with the Microsoft 365 admin center.
