Back to script samples page
Report on Office 365 unlicensed users

This script will allow you to view Office 365 licensing information for multiple unlicensed users. 

In this script we set the maximum number of results to 10,000 users.

#Connecting to Azure Active Directory

#This first command will import the Azure Active Directory module into your PowerShell session.
Import-Module MSOnline

#Capture administrative credential for future connections.
$credential = get-credential

#Establishes Online Services connection to Azure Active Directory  
Connect-MsolService -Credential $credential

#Return first 10,000 unlicensed users
Get-MsolUser -maxresults 10000 -UnlicensedUsersOnly
Downloaded 395 times
- - - - - (0)