IT 管理员经常需要查找用户的直接下属以满足合规和审计需求。虽然 Graph PowerShell 的 Get-MgUserDirectReport 命令(Get-AzureADUserDirectReport 命令的替代方案)可用于获取并导出 Microsoft Entra ID 中用户的直接下属,但其复杂且不直观的界面使其成为一个具有挑战性的选项。另一方面,ADManager Plus 作为一个 Microsoft 365 管理和报告工具,简化了这一过程,使管理员能够仅需几次点击即可快速生成并导出用户的直接下属。
以多种格式导出报告,包括 HTML、CSV 和 PDF。
安排自动生成报告。
在使用 Get-MgUserDirectReport cmdlet 之前,请确保以下事项:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "User.Read.All"
Get-MgUserDirectReport cmdlet 可用于 Microsoft Graph PowerShell 中获取 Microsoft Entra ID 中用户的直接下属。语法如下:
Get-MgUserDirectReport
-UserId <String>
[-ExpandProperty <String[]>]
[-Property <String[]>]
[-Filter <String>]
[-Search <String>]
[-Skip <Int32>]
[-Sort <String[]>]
[-Top <Int32>]
[-ConsistencyLevel <String>]
[-ResponseHeadersVariable <String>]
[-Headers <IDictionary>]
[-PageSize <Int32>]
[-All]
[-CountVariable <String>]
[-ProgressAction <ActionPreference>]
[<CommonParameters>]
列出特定用户的所有直接下属
Get-MgUserDirectReport -UserId <'user_id'>
在此命令中,将 user_id 替换为您想要列出所有直接下属的用户 ID。
下表包含一些可与 Get-MgUserDirectReport 命令一起使用的参数,以高效获取 Microsoft Entra ID 中用户的直接下属。
| 参数 | 描述 |
|---|---|
| -All | 此参数检索用户的所有直接下属,无默认分页限制。 |
| -Filter | 此参数根据属性和值过滤用户的直接下属。 |
| -UserId | 此参数根据唯一标识符(如用户主体名称或对象 ID)检索用户的直接下属。 |
| -Property | 此参数检索用户直接下属的特定属性。 |