Get Friendly License Name for all Users in Office 365 Using PowerShell

Get Friendly License Name for all Users in Office 365 Using PowerShell

When you want to look up a users license in Office 365 using PowerShell you are presented with a unfriendly Sku. Sometimes the Sku and the actual license name are similar but sometime it’s hard to distinguish the name from the Sku.

Using a hash table we can convert the Sku to its friendly name an have PowerShell do a lookup.

The script will first lookup all users that are currently licensed so it does not attempt to look up a null value. It will then go through each licensed user, take all of their licenses and put it in an array, do a lookup on each license they have and export the user’s Display Name and friendly license name to a CSV file. It will append the results to the CSV so it does not overwrite the file.

Single Tenant:

The shell will display its progress

The results will display the user and their friendly license name. This is extremely helpful if a client requests a report of user licenses and doesn’t want to keep looking up the SKU’s manually.

The Script

Multi-Tenant:

(Multi-Tenant with individual reports)

Now let’s say you want to run this against all your tenants using delegated admin. And for each client you want to have it in their own CSV file, so client A results would be its own CSV file than client B. Using the script below we can use delegated admin to run this against all of our tenants and have the results save to each client specific CSV file.

CSV File

In the first line I told it to store the CSV files at a folder at C:\Clients. Note that I do not finish the full path with the filename. This is because the script will take the path we specify and name the CSV file using the client name.

Each client CSV is seperate

The Shell

The Shell will display the same information but also include the client it’s currently working on every time it goes to a new client.

The shell will display its progress

The Script

 

Multi-Tenant:

(Multi-Tenant with a single report)

If we want to save the multi-tenant results to a single CSV file instead of individual client files we can accomplish that as well. All we have to do is delete the CSVName variable and change the Export-CSV back to the CSV variable. This will allow it to save to a single file instead of multiple files.

The Script

 

35 thoughts on “Get Friendly License Name for all Users in Office 365 Using PowerShell

  1. How difficult would it be to modify this to run the report for each customer in our partner portal, with a different csv for each customer

  2. whoah this webloց іѕ magnificent i like studying your articⅼes.
    Stay up thе good woгk! You know, lots of peoplе are ⅼօoking around
    for this information, you cⲟuld help them greatⅼy.

  3. Tried your script since it looked like what I was looking for at it takes me forever to create them myself. It launches fine and completes the login but after a short while it throws the following back at me:

    WARNING: More results are available. Please specify one of the All or MaxResults parameters.

      1. Nice response time, thank you for that. I tried the new script but sadly it still throws this back at me:

        cmdlet Get-Credential at command pipeline position 1
        Supply values for the following parameters:
        Credential
        WARNING: More results are available. Please specify one of the All or MaxResults parameters.

        Think i read somewhere there is a fault with the -all parametre but I am unsure.

        1. Looks like I missed another All param. Try the above script again

          $Users = Get-MsolUser -All | Where-Object { $_.isLicensed -eq “TRUE” } | Sort-Object DisplayName

  4. Hi – I’m developing the Periodic Table of Office 365 together with @thatmattwade – http://www.jumpto365.com. We are working on a feature where each user can logon and get a report of which licenses they have. I use the Office Graph to query that, and might use your mapping as a good starting point.

    Wonder what your source is for the mapping?

    Anything that we can work together on keeping the list fresh??

    1. I have just been using a PowerShell hashtable that I keep updated. We could always keep a shared list in GitHub and reference it? Thoughts?

  5. Got this error message

    Get-MsolUser : Parameter set cannot be resolved using the specified named parameters.
    At line:1 char:3
    + ((Get-MsolUser -All -UserPrincipalName $User.UserPrincipalName).Licen …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-MsolUser], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Online.Administration.Automation.GetUser

    Anyone known how to resolve it?

  6. getting this error:

    Get-MsolUser : Parameter set cannot be resolved using the specified named parameters.
    At C:\Users\Josh\Documents\WindowsPowerShell\licensereport.ps1:128 char:16
    + … icenses = ((Get-MsolUser -All -UserPrincipalName $User.UserPrincipalN …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-MsolUser], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Online.Administration.Automation.GetUser

  7. Hi Brad,
    As Microsoft is always changing things in the background i guess that the friendly names and accountsku names are also added and subject to change.
    Where did you find the overview of all the friendly license names and powershell sku names?

  8. Hello Brad,

    I have some more AccountSkuId’s to add to the hash table:
    “CRMSTORAGE” = “Microsoft Dynamics CRM Online Additional Storage”
    “SMB_APPS” = “Microsoft Business Apps”
    “MICROSOFT_BUSINESS_CENTER” = “Microsoft Business Center”
    “FLOW_FREE” = “Microsoft Flow Free”
    “DYN365_TEAM_MEMBERS” = “Dynamics 365 Team Members”
    “STREAM” = “Microsoft Stream Trial”

  9. Hi Brad,
    How do we add company and department in the report? And Did tried your above script but it was keeps looping non-stop.

    1. $NewObject01 | Add-Member -MemberType NoteProperty -Name “Company” -Value $User.Company
      $NewObject01 | Add-Member -MemberType NoteProperty -Name “Department” -Value $User.Department

      make sure company is a valid property.

  10. Great little Script, I am bringing back department, mobile phone etc. I am looking to combine with output from Get-mailbox forwardingsmtpaddress, I can return these separately but need to tie it with UserprincipalName from get-msoluser, Any tips would be great

  11. This looks like exactly what I am looking for.
    Although, I think that the array of skuids in it don’t account for O365 E5 licenses.

    I get errors for all my users that say:
    Finding bmgf:ENTERPRISEPREMIUM in the Hash Table…
    Finding bmgf:EMSPREMIUM in the Hash Table…
    Error: The Hash Table has no match for EMSPREMIUM for UserX!

  12. Is there a way that the license options can also be shown to see what is enabled and disabled for each user? For example, I have users who have been assigned Project Online Premium licenses, but disabled the license option for Project Online due to an application constraint.

Leave a Reply

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

%d bloggers like this: