Office 365 Counting License Usage Details in PowerShell

Counting the licensing usages and checking out the license details in Office 365 using PowerShell is a lot easier than going through the admin console.

First, install the module if you haven’t done, and connect to Azure AD with your Office 365 subscription.

Install-Module msonline
Connect-MsolServie

To list of the licensing plans available in my tenant:

Get-MsolAccountsku

To view a full list of licensed accounts:

Get-MsolUser | Where {$_.IsLicensed}

How many of my users are licensed in Premium?

Get-MsolUser | Where {($_.Licenses).AccountSkuID -eq $accountskuid}

Where $accountskuid can be found in the cmdlet Get-MsolAccountsku described above.

Need to export the result in CSV for reporting purpose?

Get-MsolUser | Where {($_.Licenses).AccountSkuID -eq $accountskuid} | Export-CSV "path\csvname"

Leave a Reply

Your email address will not be published. Required fields are marked *