MS-102 Deploy and manage a Microsoft 365 tenant Practice Question
Exhibit
Refer to the exhibit.
```
Get-MsolUser -All | Where-Object {$_.isLicensed -eq $false} | Select-Object UserPrincipalName
```Refer to the exhibit. You run this PowerShell command in your Microsoft 365 tenant. What is the purpose of the command?
⚠ Common exam trap
Many candidates confuse the `assignedLicenses/$count eq 0` filter with a filter for unlicensed users in a specific location or with sign-in status, but the command lacks any additional filters for usage location or account status.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
To list all unlicensed users in the tenant
The PowerShell command `Get-MgUser -Filter 'assignedLicenses/$count eq 0' -ConsistencyLevel eventual` retrieves all users in the Microsoft 365 tenant who have no licenses assigned. The `assignedLicenses/$count eq 0` filter checks that the count of assigned licenses is zero, and `-ConsistencyLevel eventual` is required for advanced queries on directory objects. This directly corresponds to listing all unlicensed users in the tenant.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
To list all users with sign-in blocked
Why it's wrong here
This command filters on the AssignedLicenses property, not on the user's sign-in or account status. A sign-in-blocked user is typically identified by AccountEnabled set to False or by a SignInActivity/SignInBlocked flag, but the Where-Object clause never evaluates those properties. As a result, the command would list unlicensed users whose sign-in is allowed as well as those whose sign-in is blocked, so it cannot serve as a sign-in-blocked report.
- ✗
To list all unlicensed users with a specific usage location
Why it's wrong here
The command's filter checks only whether the AssignedLicenses collection is empty, so it returns all unlicensed users across every usage location in the tenant. To restrict the result to a specific usage location, you would need an additional condition such as $_.UsageLocation -eq 'US' combined with the license count check. Without that usage-location filter, the output is not scoped to one country/region, making this option incorrect.
- ✓
To list all unlicensed users in the tenant
Why this is correct
The Where-Object clause {$_.AssignedLicenses.Count -eq 0} correctly targets users whose AssignedLicenses collection has zero entries, meaning no license SKU has been assigned to the account. Because the cmdlet enumerates all user objects in the directory (with the -All switch or through Graph pagination), the result is the complete set of unlicensed users in the tenant. This is the intended purpose of the command.
- ✗
To list all users who have a license assigned
Why it's wrong here
This option is the inverse of the command's logic. A licensed user has at least one entry in AssignedLicenses, so their AssignedLicenses.Count is greater than 0, not equal to 0. To list licensed users, you would change the filter to AssignedLicenses.Count -gt 0 (or -ne 0). The command as written explicitly excludes those accounts and therefore cannot list users who have a license assigned.
Go deeper
Related to this question
Learn chapter
B2B Direct Connect and Cross-Tenant Sync
Key term
Microsoft 365
Microsoft 365 is a subscription-based cloud service from Microsoft that combines productivity tools like Office apps with security, device management, and online storage.
Key term
Microsoft 365 tenant
A Microsoft 365 tenant is a dedicated, isolated instance of Microsoft 365 services created for an organization when they sign up for a subscription.
About these practice questions
One of 712 original MS-102 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MS-102 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MS-102 exam.