How to Get a List of Unlicensed Users in Office 365

In this article, I'll show you to get all O365 users which have not been assigned any license.

Prerequisites

Download and install the following modules.

  1. Microsoft Online Service Sign-in Assistant for IT Professionals RTW
  2. Windows Azure Active Directory Module for Windows PowerShell (64-bit version)

Get a List of Unlicensed Users in Office 365

To get a list of unlicensed users in Office 365, follow these simple steps:

-Open PowerShell with elevated privileges.

-Execute the following command. When you are prompted, enter your O365 global admin account or an account having required privileges.

$credential = Get-Credential

-Execute the following command to connect to O365.

Connect-MsolService -Credential $credential

-Now you are connected, execute the following command to get a list of unlicensed users.

Get-MsolUser -All -UnlicensedUsersOnly

You can also execute the following command. They both will return same result.

Get-MsolUser -All | where {$_.isLicensed -eq $true}