So, you already know how to get license usage information from the Microsoft Online Portal, but now you are looking for a way to accomplish the same thing via PowerShell.  Perhaps you are working on a little bit of automation to create a CSV report of usage information that you can send to yourself or team.  The following script should be helpful as it will get the license usage information and dump it to a CSV file along with displaying the same results to the PowerShell console.  In order for the script to work, you will need to download and install the Microsoft Online Services Module for Windows PowerShell. 

Read the help information for details on how to execute the script.

Get-help .\GetMsolTenantSkuUsage.ps1 -full

A copy of the script can be downloaded by clicking on the link below.