Get-LKUser
Queries Entra ID users with flexible name and department filtering.
Syntax
Get-LKUser
[-Name <String[]>]
[-NameMatch <String>]
[-Department <String>]
[-FilterScript <ScriptBlock>]
[-DisplayAs <String>]
[<CommonParameters>]
Parameters
-Name
Search by display name or UPN.
| Attribute | Value |
| Type | String[] |
| Required | No |
-NameMatch
| Attribute | Value |
| Type | String |
| Default | Contains |
| Valid values | Contains, Exact, Wildcard, Regex |
-Department
Filter by department name.
| Attribute | Value |
| Type | String |
| Required | No |
-FilterScript
| Attribute | Value |
| Type | ScriptBlock |
-DisplayAs
Controls output format. Default shows full object properties (List). Table shows a compact view with key columns sized to fit the data.
| Attribute | Value |
| Type | String |
| Default | List |
| Valid values | List, Table |
Outputs
| Property | Type | Description |
| Id | String | User object ID |
| DisplayName | String | Full name |
| UserPrincipalName | String | UPN |
| Mail | String | Email address |
| JobTitle | String | Job title |
| Department | String | Department |
| AccountEnabled | Boolean | Account status |
Examples
Example 1 - Search by name
Get-LKUser -Name "John" -NameMatch Contains
Example 2 - Search by UPN
Get-LKUser -Name "john.doe@contoso.com" -NameMatch Exact
Example 3 - Filter by department
Get-LKUser -Department "IT"