Set-MsolUserLicense -UserPrincipalName "" -AddLicenses "" To assign a license to a user, use the following command in PowerShell. If you use the Get-MsolUser cmdlet without using the -All parameter, only the first 500 accounts are returned. Set-MsolUser -UserPrincipalName "" -UsageLocation įor example: Set-MsolUser -UserPrincipalName -UsageLocation US To set the UsageLocation value on an account, run this command. Get-MgUser -Select Id,DisplayName,Mail,UserPrincipalName,UsageLocation,UserType | where To find accounts that don't have a UsageLocation value, run this command. For more information, see About license restrictions. Some Microsoft 365 services aren't available in certain countries/regions. For example, US for the United States, and FR for France. You can only assign licenses to user accounts that have the UsageLocation property set to a valid ISO 3166-1 alpha-2 country code. Get-MgUser -Filter 'assignedLicenses/$count eq 0 and OnPremisesSyncEnabled eq true' -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All -Select UserPrincipalName To find the unlicensed synchronized users in your organization, run this command. Get-MgUser -Filter 'assignedLicenses/$count eq 0' -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All To find the unlicensed accounts in your organization, run this command. For more information about licensing plans, licenses, and services, see View licenses and services with PowerShell. The number of available licenses in each plan is ActiveUnits - WarningUnits - ConsumedUnits. Run the Get-MgSubscribedSku command to view the available licensing plans and the number of available licenses in each plan in your organization. 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' Microsoft Graph API reference page. For a list of additional resources, see Manage users and groups. Learn how to assign licenses to user accounts with the Microsoft 365 admin center.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |