Friday 25 June 2021

Get Office 365 users with a specific license

First we have to connect MSOLService through powershell.

Connect-MsolService

Then get the list of available licenses with the following command.

Get-MsolAccountSku

then we can use the following command to Get the users with a specific license

Get-MsolUser -MaxResults 200000 | Where-Object {($_.licenses).AccountSkuId -match "p:ems"} >c:\pathc\EMSUsers.CSV

No comments:

Post a Comment