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 } }
Awesome script Jack. Wasn’t aware of the format for strings to align them this way. I read a bit more on the $Line variable formatting here on how you indented the licenses available and used: http://www.computerperformance.co.uk/powershell/powershell_-f_format.htm