Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Get-EntraUserManager

Gets the manager of a user.

Syntax

Default (Default)

Get-EntraUserManager

 -UserId <String>
 [-Property <String[]>]
 [<CommonParameters>]

Description

The Get-EntraUserManager cmdlet gets the manager of a user in Microsoft Entra ID. Specify UserId parameter to get the specific manager of user.

Examples

Example 1: Get the manager of a user

Connect-Entra -Scopes 'User.Read.All'
Get-EntraUserManager -UserId 'SawyerM@contoso.com' |
Select-Object Id, displayName, userPrincipalName, createdDateTime, accountEnabled, userType |
Format-Table -AutoSize
id displayName userPrincipalName createdDateTime accountEnabled userType
-- ----------- ----------------- --------------- -------------- --------
00aa00aa-bb11-cc22-dd33-44ee44ee44ee Patti Fernandez PattiF@Contoso.com 10/7/2024 12:32:01 AM True Member

This example demonstrates how to retrieve the manager of a specific user.

  • -UserId Parameter specifies UserId or User Principal Name of User.

Example 2: List users without a manager

Connect-Entra -Scopes 'User.Read.All'
$allUsers = Get-EntraUser -All
$usersWithoutManagers = foreach ($user in $allUsers) {
 $manager = Get-EntraUserManager -UserId $user.Id -ErrorAction SilentlyContinue
 if (-not $manager) {
 [PSCustomObject]@{
 Id = $user.Id
 DisplayName = $user.DisplayName
 UserPrincipalName = $user.UserPrincipalName
 UserType = $user.userType
 AccountEnabled = $user.accountEnabled
 CreatedDateTime = $user.createdDateTime
 }
 }
}
$usersWithoutManagers | Format-Table Id, DisplayName, UserPrincipalName, CreatedDateTime, UserType, AccountEnabled -AutoSize
Id DisplayName UserPrincipalName CreatedDateTime UserType AccountEnabled
-- ----------- ----------------- --------------- -------- --------------
cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 10/7/2024 2:24:26 PM Member True
bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com 10/7/2024 12:33:36 AM Member True

This example demonstrates how to retrieve users without managers.

Parameters

-Property

Specifies properties to be returned.

Parameter properties

Type:

System.String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Select

Parameter sets

-UserId

Specifies the ID of a user's UserPrincipalName or UserId in Microsoft Entra ID.

Parameter properties

Type:System.String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ObjectId, UPN, Identity, UserPrincipalName

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Related Links


Feedback

Was this page helpful?