Hello Mytoast Admin,
Thank you for reaching out to Microsoft Support!
To check which licenses were assigned to users in your Microsoft 365 (M365) tenant, you can use PowerShell and the Microsoft Graph API. Here are the steps:
- View License Details Using PowerShell:
- Connect to your M365 tenant using PowerShell with the necessary permissions.
- List the license plans for your tenant using the command:
Get-MgSubscribedSku
- To list the services available in each licensing plan, use:
$allSKUs = Get-MgSubscribedSku -Property SkuPartNumber, ServicePlans $allSKUs | ForEach-Object { Write-Host "Service Plan:" $_.SkuPartNumber $_.ServicePlans | ForEach-Object {$_} }
- To list the licenses assigned to a specific user account, use:
Get-MgUserLicenseDetail -UserId "<user sign-in name (UPN)>"
- View Licensed and Unlicensed Users:
- To find unlicensed users (those without any assigned licenses), run:
Get-MgUser -Filter 'assignedLicenses/$count eq 0' -ConsistencyLevel eventual -CountVariable unlicensedUserCount -All Write-Host "Found $unlicensedUserCount unlicensed users."
- To find licensed users (those with assigned licenses), run:
Get-MgUser -Filter 'assignedLicenses/$count ne 0' -ConsistencyLevel eventual -CountVariable licensedUserCount -All -Select UserPrincipalName, DisplayName, AssignedLicenses | Format-Table -Property UserPrincipalName, DisplayName, AssignedLicenses Write-Host "Found $licensedUserCount licensed users."
- To find unlicensed users (those without any assigned licenses), run:
Remember to replace <user sign-in name (UPN)>
with the actual user’s UPN.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.