License & Subscription Issues

Get Microsoft 365 License and Service Plan Counts with PowerShell

Nimra MalikNimra Malik Nov 22, 2026 868 views

Question details

Count assigned Microsoft 365 product licenses and report service plan assignments using PowerShell.

Get Microsoft 365 License and Service Plan Counts with PowerShell
Product
Microsoft 365 and Microsoft Graph PowerShell
Device & OS
not provided
Scenario
An administrator needs tenant-wide counts for product licenses and bundled service plans.
Observed behavior
The desired report shows product license counts or successfully provisioned service plans grouped by product.
Before you start

Use an account authorized to read users, license details, and subscription information in the Microsoft 365 tenant. Install the Microsoft Graph PowerShell SDK and obtain admin consent for the required permissions if your tenant requires it.

Solution 1Recommended

Count provisioned service plans by Microsoft 365 product

Use Microsoft Graph PowerShell to export a count of users with successfully provisioned service plans for each product.

This report counts distinct users per product and service plan when the plan's provisioning status is Success. It excludes disabled and pending plans, so it is not a count of every assigned or enabled plan.

A user with the same service plan through multiple products can appear in more than one product group. Do not add those groups together to calculate a tenant-wide unique-user count.

1
Connect to Microsoft Graph

Open PowerShell and run: Connect-MgGraph -Scopes "User.Read.All", "LicenseAssignment.Read.All". Sign in and grant consent if prompted. If the SDK is not installed, first run Install-Module Microsoft.Graph -Scope CurrentUser.

2
Inspect one user's plans

Run Get-MgUserLicenseDetail -UserId "user@domain.com" | Select-Object SkuPartNumber -ExpandProperty ServicePlans to see the product, service plan names, and provisioning statuses for that user.

3
Export counts by product and plan

Run the following script in PowerShell. It retrieves licensed users, groups successfully provisioned plans by product and plan name, and writes the counts to the current folder: $users = Get-MgUser -All -Property Id,UserPrincipalName,AssignedLicenses | Where-Object { $_.AssignedLicenses.Count -gt 0 } $rows = foreach ($user in $users) { foreach ($license in (Get-MgUserLicenseDetail -UserId $user.Id)) { foreach ($plan in $license.ServicePlans) { if ($plan.ProvisioningStatus -eq 'Success') { [pscustomobject]@{ UserId = $user.Id; SkuPartNumber = $license.SkuPartNumber; ServicePlanName = $plan.ServicePlanName } } } } } $rows | Group-Object SkuPartNumber,ServicePlanName | ForEach-Object { $group = $_.Group [pscustomobject]@{ SkuPartNumber = $group[0].SkuPartNumber ServicePlanName = $group[0].ServicePlanName ProvisionedUsers = @($group.UserId | Sort-Object -Unique).Count } } | Export-Csv -Path '.\service-plan-counts.csv' -NoTypeInformation

4
Review the report

Open service-plan-counts.csv in a spreadsheet and filter the ServicePlanName or SkuPartNumber column for the service or product you need.

Count provisioned service plans by Microsoft 365 product
Service names can differ from product names: Service plan identifiers depend on the SKU. Older plans may use MCOSTANDARD for Skype for Business Online or SHAREPOINTENTERPRISE for SharePoint-related services that include OneDrive. Inspect the plans in your tenant rather than assuming every SKU uses the same identifier.
Free Microsoft Office alternative

Review Microsoft 365 License Reports in WPS Office

WPS Office is a free, lightweight Microsoft Office alternative with a familiar interface and compatible file formats for a smooth transition. Use WPS Spreadsheets to review exported license reports; Microsoft Graph remains necessary to retrieve tenant data.

Open and filter CSV service plan reports in WPS SpreadsheetsCompatible with Microsoft Excel XLS and XLSX filesFamiliar spreadsheet interface for reviewing license countsFree, lightweight office tools for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

How can I check service plans for just one user?

Connect with Connect-MgGraph, then run Get-MgUserLicenseDetail -UserId "user@domain.com" | Select-Object SkuPartNumber -ExpandProperty ServicePlans. Check ServicePlanName and ProvisioningStatus in the output.

Why doesn't a product license count match a service plan count?

A product can bundle several service plans, and a plan may be disabled or still provisioning for some users. The report above counts only plans with a Success provisioning status.

What happened to Get-MsolUser?

Get-MsolUser belongs to the retired MSOnline PowerShell module. Use Microsoft Graph PowerShell commands such as Get-MgUser and Get-MgUserLicenseDetail for current reporting.

Can I count OneDrive or Skype for Business by filtering the report?

Open the CSV and filter ServicePlanName for the identifiers present in your tenant. Some older SKUs use SHAREPOINTENTERPRISE for SharePoint-related services that include OneDrive and MCOSTANDARD for Skype for Business Online. Skype for Business Online has been retired, so historical identifiers may not represent an active service.