Home » Office 365 » How to Get Msol UnLicensed Users in PowerShell

How to Get Msol UnLicensed Users in PowerShell

To get all unlicensed users in Office 365, use the Get-MsolUser cmdlet in PowerShell with the -UnlicensedUsersOnly parameter.

Get-MsolUser -All -UnlicensedUsersOnly

This command lists all unlicensed user accounts in your organization.

The Get-MsolUser cmdlet uses the -All parameter to return all users and check for the unlicensed users only using the –UnlicensedUsersOnly parameter.

The -UnlicensedUsersOnly parameter returns only users who are not assigned a license.

The output of the above PowerShell script to display unlicensed user accounts is given below.

Get Unlicensed Users in Azure Active Directory
Get Unlicensed Users in Azure Active Directory

Cool Tip: How to get licensed users in Office 365 with PowerShell!

Conclusion

I hope the above article on how to retrieve a list of unlicensed users in Office 365 is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.