当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] Get-MgUserManager - 查找用户管理器

作者:精品下载站 日期:2024-12-14 06:28:36 浏览:16 分类:玩电脑

Get-MgUserManager - 查找用户管理器


PowerShell 中的 Get-MgUserManager cmdlet 可检索指定为用户经理的用户或组织联系人。

要使用 Get-MgUserManager cmdlet,必须首先使用 Connect-MGraph cmdlet 连接到 Microsoft 365 租户。连接后,您可以使用 Get-MgUserManager cmdlet 获取指定用户的管理员。

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

下面给出了获取指定用户的经理详细信息的语法。

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

在本文中,我们将讨论如何在 PowerShell 中使用 Get-MgUserManager cmdlet 来获取用户的管理员。

如何获得用户经理

要获取用户的管理员,请运行以下命令。

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

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

Get-MgUserManager 命令使用 -UserId 参数指定用户以检索指定为用户经理的用户或联系人。它将用户详细信息(例如 ID)存储在 $userId 变量中。

Get-MgUser 命令使用 -UserId 参数指定 $userId 并检索指定用户的经理详细信息。

下面给出了返回指定用户的管理员的上述命令的输出。

[玩转系统] Get-MgUserManager - 查找用户管理器

结论

希望以上关于如何在PowerShell中使用Get-MgUserManager cmdlet获取用户经理信息的文章对您有所帮助。

您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。

相关链接

获取 MgUser

设置 MgUserManagerByRef

删除-MgUserManager

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯