Try this:
Get-MsolUser -All |select UserPrincipalName,@{n="Licenses Type";e={$_.Licenses.AccountSKUid}} | Export-CSV c:\temp\users.csv
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello Everyone
I am trying to export all users with specific licenses into a csv-file. Here is the command I've been trying to use:
Get-MsolUser -all | Select FirstName, LastName, DisplayName, City, Country, PrincipalName, Title, Department, Licenses | Where-Object {($_.Licenses).LicenseAssigned -match "PROJECTPROFESSIONAL" -or "PROJECTPREMIUM" -or "PROJECTESSENTIALS" -or "POWER_BI_PRO" } | export-csv C:\export5.csv -NoTypeInformation -Encoding UTF8 -Append
Unfortunately the export doesn't give me the licenses, only this entry: System.Collections.Generic.List`1[Microsoft.Online.Administration.UserLicense]
What am I doing wrong? My goals is to see all the details I mentioned plus if they are using the licenses, which of the licenses they are having.
Thank you for your Help.
Kind regards,
Gabriel
Try this:
Get-MsolUser -All |select UserPrincipalName,@{n="Licenses Type";e={$_.Licenses.AccountSKUid}} | Export-CSV c:\temp\users.csv
There are many examples of how to do this if look for them. Try searching for something like "powershell export msol users with licenses".
Here's just one result: export-list-office-365-users-licenses-customer-tenants-delegated-administration
Hi @Bühler Gabriel ,
You need to search by AccountSkuId.
Specifying the tenant name:
Get-MsolUser -UserPrincipalName $audituser | Select-Object -ExpandProperty Licenses | Where-Object {$_.AccountSkuID -eq $TenantName + ':POWER_BI_PRO'}
The tenant domain name prefixes the SKU:
Get-MsolUser -all | Select FirstName, LastName, DisplayName, City, Country, PrincipalName, Title, Department, Licenses | Where-Object{ $_.Licenses.AccountSkuId -match "tenantdomainname:PROJECTPREMIUM" }
Additional examples: