How do I export users from Office 365, using PowerShell?
Quite often, it is necessary to have an overview of all the licensed users within an Office 365 tenant. Using PowerShell and the Office 365 cmdlets, it is possible to get a list of users, both with and without licenses, for further analysis (for example, for reporting purposes).
The following PowerShell cmdlet will provide this output:
Get-MsolUser | Get-Member | Out-GridView
This Microsoft Support article provides a full explanation of how to do this: https://support.microsoft.com/en-us/kb/2777380.