Granular O365 License details.

I would like to get a granular O365 license like below through powershell script. There are many websites which gives only the License plan but not the sub components within it.

Appreciate if some one could help on this.

Office 365 Small Business Premium | LITEPACK_P2

EXCHANGE_L_STANDARD      Exchange Online (Plan 1)
MCOLITE      Lync Online (Plan 1)
SHAREPOINTLITE      SharePoint Online (Plan 1)
OFFICE_PRO_PLUS_SUBSCRIPTION_SMBIZ      Office ProPlus
Office 365 Midsize Business | MIDSIZEPACK

EXCHANGE_S_STANDARD_MIDMARKET      Exchange Online (Plan 1)
MCOSTANDARD_MIDMARKET      Lync Online (Plan 1)
SHAREPOINTENTERPRISE_MIDMARKET      SharePoint Online (Plan 1)
SHAREPOINTWAC      Office Online
OFFICESUBSCRIPTION      Office ProPlus
YAMMER_MIDSIZE      Yammer
Office 365 Enterprise E3 | ENTERPRISEPACK

EXCHANGE_S_STANDARD      Exchange Online (Plan 2)
MCOSTANDARD      Lync Online (Plan 2)
SHAREPOINTENTERPRISE      SharePoint Online (Plan 2)
SHAREPOINTWAC      Office Online
OFFICESUBSCRIPTION      Office ProPlus
RMS_S_ENTERPRISE      Azure Active Directory Rights Management
YAMMER_ENTERPRISE      Yammer

Tried below MS script but the output is not as required.

# Define Hashtables for lookup 
$Sku = @{ 
    "OFFICESUBSCRIPTION_STUDENT" = "Office 365 (Plan K1)" 
    "EXCHANGESTANDARD_ALUMNI" = "Office 365 Exchange Online Only" 
    "STANDARDWoffPACK_IW_STUDENT" = "Office 365 (Plan A1) for Students" 
    "STANDARDWOFFPACK_STUDENT" = "Office 365 (Plan A2) for Students" 
    "STANDARDWOFFPACK_FACULTY" = "Office 365 (Plan A2) for Faculty" 
    "ENTERPRISEPACK_FACULTY" = "Office 365 (Plan A3) for Faculty" 
   } 
         
# The Output will be written to this file in the current working directory 
$LogFile = "Office_365_Licenses.csv" 
 


 
# Get a list of all licences that exist within the tenant 
$licensetype = Get-MsolAccountSku | Where {$_.ConsumedUnits -ge 1} 
 
# Loop through all licence types found in the tenant 
$headerstring = "DisplayName,UserPrincipalName,AccountSku" 
foreach ($license in $licensetype)  
{     
    # Build and write the Header for the CSV file 
    
     
    foreach ($row in $($license.ServiceStatus))  
    { 
        # Build header string 
        switch -wildcard ($($row.ServicePlan.servicename)) 
        { 
            "EXC*" { $thisLicence = "Exchange Online" } 
            "MCO*" { $thisLicence = "Lync Online" } 
            "LYN*" { $thisLicence = "Lync Online" } 
            "OFF*" { $thisLicence = "Office Profesional Plus" } 
            "SHA*" { $thisLicence = "Sharepoint Online" } 
            "*WAC*" { $thisLicence = "Office Web Apps" } 
            "WAC*" { $thisLicence = "Office Web Apps" } 
            default { $thisLicence = $row.ServicePlan.servicename } 
        } 
         
        $headerstring = ($headerstring + "," + $thisLicence) 
		
		
    } 
     
      Out-File -FilePath $LogFile -InputObject $headerstring -Encoding UTF8 -append 

     
 }   
 

Open in new window

o365AdmAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vasil Michev (MVP)Commented:
There are way too many of those and I have given up keeping track long ago. Best resource you can use is this blog post: http://blogs.technet.com/b/treycarlee/archive/2013/11/01/list-of-powershell-licensing-sku-s-for-office-365.aspx

Make sure to also check the comment below, we update with the new SKUs/ServicePlans.
o365AdmAuthor Commented:
Hi Vasil,


The script in the above link checks the license for all the users and assigns for the unlicensed users.
Vasil Michev (MVP)Commented:
And *below* the script there is a listing of SKUs/ServicePlans, which is what you are looking for, no? Look in the comments as well.

Anyway, that's the most complete listing I'm aware of.
o365AdmAuthor Commented:
Hi Vasil,

My SKU units

AccountSkuId                                                            ActiveUnits     WarningUnits    ConsumedUnits
------------                                                            -----------     ------------    -------------
Xyz:OFFICESUBSCRIPTION_FACULTY                                   700           0             0
Xyz:OFFICESUBSCRIPTION_STUDENT                                   30            0             2
Xyz:STANDARDWOFFPACK_FACULTY                                     200           0             1
Xyz:ENTERPRISEPACK_FACULTY                                       1000          0             27
Xyz:STANDARDWOFFPACK_STUDENT                                     6000          0             2
Xyz:STANDARDWOFFPACK_IW_STUDENT                                  1000          0             390
Xyz:EXCHANGESTANDARD_ALUMNI                                      1000          0             1
 
I want a output like below, the same way we see when the apply license in the O365 portal:
Office 365 ProPlus
      Mobile Device Management for Office 365 ‎
      OneDrive for Business ‎(Plan 1)‎
      Office 365 ProPlus

Office 365 E3
      Mobile Device Management for Office 365 ‎
      Yammer for Academic ‎
      Office Online for Education
      Skype for Business Online ‎(Plan 2)‎
      SharePoint Plan 1 for EDU
      Exchange Online ‎(Plan 1)‎
etc....
...............
.........
Vasil Michev (MVP)Commented:
Well if the plans are not already listed on the blog post above, you can get them via:

(Get-MsolAccountSku | ? {$_.AccountSkuId -eq "Xyz:OFFICESUBSCRIPTION_FACULTY "}).ServiceStatus

Open in new window


Then replace it with the corresponding 'human readable name' via the hashtable example in your first post. But you will still need to get those names from somewhere. If you cannot find them listed anywhere, you can get them by viewing the source on the O365 admin portal page. The will be listed as individual <div> elements and the label will get you the plan name:

<div title="Azure Rights Management" class="csmListControlItem csmCheckboxOutter"><input name="_ctl_39_children" id="item50" type="checkbox" value="RMS_S_ENTERPRISE"><label id="item50_label" for="item50">Azure Rights Management</label></div>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Office 365

From novice to tech pro — start learning today.