为 Microsoft Entra ID 用户分配经理对于组织结构、报告工作流程和委派至关重要。Microsoft Graph PowerShell 中的 Set-MgUserManagerByRef cmdlet 允许管理员更新用户的经理,取代了传统的 Set-AzureADUserManager 命令。然而,基于 PowerShell 的配置需要熟悉脚本编写和适当的权限,这可能会减慢日常管理任务的速度。
使用 ManageEngine ADManager Plus,可以直接从工具中分配或更新用户的经理——无需编写脚本。
使用 Set-MgUserManagerByRef cmdlet 之前:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.ReadWrite.All"
此 cmdlet 列出特定用户直接所属的组:
Set-MgUserManagerByRef -UserId <UserId> -RefObjectId <ManagerId>
为用户分配经理:
Set-MgUserManagerByRef -UserId "alex@zkyy.com" -RefObjectId "roberts@zkyy.com"
| 参数 | 描述 |
|---|---|
| -UserId | 此参数用于指定用户的唯一标识符。 |
| -RefObjectId | 此参数用于指定将被设置为经理的用户的对象 ID。 |