PS Script to list all Office 365 licenses and sublicenses available (AccountSKUID and ServiceName)

We’re transitioning some licensing at work and I thought it would be helpful to have a ‘catalog’ of all the available options.

The script below will produce such a list…

#note, you must run connect-msol first!
$licenses = get-msolaccountsku
Write-host "This script will output all the license and sublicense types for your tenant"
write-host "(Technically, these are AccountSkuID and ServiceStatus.Serviceplan.Servicename)" -foregroundcolor gray
write-host " "
write-host "Primary License (AccountSkuID)" -foregroundcolor green
write-host "   Sub License (AccountSkuID.ServiceStatus.ServicePlan.ServiceName)" -foregroundcolor yellow
write-host "----------------------------------------------------------------------------"
foreach ($license in $licenses)
{
    $line = "{0,-35} {1,18} {2,18}" -f $license.accountskuID, "($($license.activeunits) active)", "($($license.consumedunits) used)" 
    write-host $line -foregroundcolor green
  
    foreach ($sublicense in $license.servicestatus)
	{
    	write-host  "   $($sublicense.serviceplan.servicename)" -foregroundcolor yellow
    }
}

 

One thought on “PS Script to list all Office 365 licenses and sublicenses available (AccountSKUID and ServiceName)

Leave a Reply to Eric Schrader (@eschraderMB)Cancel reply