Install required software
1. Ensure you are running Windows 8.1, Windows 8, or Windows 7.
2. Make sure you have the .NET Framework 3.51 feature.
3. Make sure you have the latest updates.
4. Install the Microsoft Online Services Sign-In assistant.
5. Install the Windows Azure Active Directory (Azure AD) module for the appropriate version of your operating system.
6. Open powershell as administrator.
7. Import-Module MSOnline
8. Get-Credential (Windows PowerShell dialog box appears)
9. Enter your credentials.
10. Connect-MsolService
11. Get-MsolUser -All |Sort isLicensed
12. Finish.