Managing Microsoft Entra ID user-manager relationships is crucial for maintaining accurate organizational hierarchies and enforcing access policies. IT administrators often need to remove a user's manager due to role changes, restructuring, or compliance requirements. While the Remove-MgUserManagerByRef PowerShell command in Microsoft Graph allows admins to detach a manager from a user profile, it requires scripting expertise and manual execution.
ManageEngine ADManager Plus is an identity governance and administration solution designed to simplify Microsoft Entra ID management and reporting. With advanced management actions and in-depth reports, it optimizes administrative tasks and minimizes IT workload.
Before running the Remove-MgUserManagerByRef cmdlet, ensure the following requirements are met:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.ReadWrite.All"
Use the Remove-MgUserManagerByRef cmdlet in Microsoft Graph PowerShell to remove managers of Microsoft Entra ID users. The syntax is as follows:
Remove-MgUserManagerByRef
-UserId <String>
[-IfMatch <String>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PassThru]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Example: Remove the manager of a user
Use this Graph PowerShell command to remove a Microsoft Entra ID user's manager.
Remove-MgUserManagerByRef -UserId '8a7c50d3-fcbd-4727-a889-8ab232dfea01'
The table below lists key parameters that can be used with the Remove-MgUserManagerByRef cmdlet to remove Microsoft Entra ID users' managers.
| Parameters | Description |
|---|---|
| -Confirm | This is to confirm before running the cmdlet. |
| -UserId | This is the unique identifier of a user. |
| -WhatIf | This shows what would happen if the cmdlet was run. |