dear sir, i built on your path & did the following "get-azureaduser -all 1 | select upn -expandproperty licenses | select upn,skuid | ? skuid -match "skustring"
this is very fast, and if you can over look some psuedo syntax, allows for some pretty good results. * the 2nd select allows you to ? very easily.
Get list of Azure users with specific License
Hi,
I need to get a lsit of users with a specific O365License.
I'm using this:
$ulist=Get-AzureADUser -All 1 | Select userprincipalname -ExpandProperty AssignedLicenses | Where-Object {$_.SkuID -eq '6fd2c87f-b296-42f0-b197-1e91e994b900'} | select userprincipalname
Is there a better/faster way to achieve this?
Thanks,
JD
5 answers
Sort by: Newest
-
Phill (Radar) Kenyon 6 Reputation points
2021-02-09T20:01:53.377+00:00 -
theodorbrander 51 Reputation points
2019-12-18T13:16:35.773+00:00 Hi junidev,
An alternative to Powershell would be the portal.
Open the AAD blade->groups->members->Download members-T
-
Vaibhav Patel 6 Reputation points
2019-12-18T10:36:49.173+00:00 Hi @juni dev
Please find below script which will give you the all services for a user who has been assigned multiple license
$userUPN=""
$AllLicenses=(Get-MsolUser -UserPrincipalName $userUPN).Licenses
$licArray = @()
for($i = 0; $i -lt $AllLicenses.Count; $i++)
{
$licArray += "License: " + $AllLicenses[$i].AccountSkuId
$licArray += $AllLicenses[$i].ServiceStatus
$licArray += ""
}
$licArrayOR
This will give you the all users with specific license
Get-MsolUser | Where-Object {($_.licenses).AccountSkuId -match "EnterprisePremium"} | Out-file C:\temp\result.csv
-
Vasil Michev 95,571 Reputation points MVP
2019-12-17T17:42:36.753+00:00 There's no server-side way to filter this, as the stupid ODATA syntax used by the Graph has very limited filtering capabilities and the assignedLicenses practically cannot be used.
-
Biju Thankappan 101 Reputation points
2019-12-16T17:25:04.19+00:00