Finding Unlicensed Users in O365

Use these commands to check which users don’t have a license or need a different license. This is different from the search/filter in the Admin portal because it checks for the LicenseReconciliationNeeded attribute rather than IsLicensed. For example if you have a user with an Azure AD P2 license but they need an Exchange Online license the admin portal doesn’t give you a good way to filter this out.

#get connected

#show list of users that we need to license
get-msoluser -All | where {$_.LicenseReconciliationNeeded -eq $true}

#show the availible licenses that we have in the tenant, we are going to be looking for the E3 license "tenantnamehere:ENTERPRISEPACK"

#assign a usage location to the users we are going to license
get-msoluser -All | where {$_.LicenseReconciliationNeeded -eq $true} |Set-MsolUser -UsageLocation "US"

#assign the licenses to the users
get-msoluser -All | where {$_.LicenseReconciliationNeeded -eq $true} |Set-MsolUserLicense -AddLicenses "tenantnamehere:ENTERPRISEPACK"

Your users should be all set with their new licenses.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s