Home » Microsoft 365 » Get-MgUserManager – Find Users Manager

Get-MgUserManager – Find Users Manager

The Get-MgUserManager cmdlet in PowerShell retrieves the user or organizational contact assigned as the user’s manager.

To use the Get-MgUserManager cmdlet, you must first connect to your Microsoft 365 tenant using the Connect-MGraph cmdlet. Once you are connected, you can use the Get-MgUserManager cmdlet to get the manager of the specified user.

Connect-MgGraph -Scopes 'User.Read.All'

The syntax to get the manager details of the specified user is given below.

Get-MgUserManager
   -UserId <String>
   -InputObject <IUsersIdentity>
   [-ExpandProperty <String[]>]
   [-Property <String[]>]
   [<CommonParameters>]

In this article, we will discuss using the Get-MgUserManager cmdlet in PowerShell to get a user’s manager.

How to Get a User’s Manager

To get a user’s manager, run the following command.

# Get manager user ID
$userId = Get-MgUserManager -UserId 'cf634aac-d7d1-41a4-aad9-544c0bfda070'

# Get the manager user details
Get-MgUser -UserId $userId.Id

The Get-MgUserManager command uses the -UserId parameter to specify the user to retrieve the user or contact assigned as the user’s manager. It stores the user details such as ID in the $userId variable.

The Get-MgUser command uses the -UserId parameter to specify the $userId and retrieve the manager details for the specified user.

The output of the above command to return the manager of the specified user is given below.

Get Mg User Manager
Get Mg User Manager

Conclusion

I hope the above article on how to use the Get-MgUserManager cmdlet in PowerShell to get the user’s manager information is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Get-MgUser

Set-MgUserManagerByRef

Remove-MgUserManager