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

[玩转系统] Update-MgUser - 更新用户的属性

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

Update-MgUser - 更新用户的属性


PowerShell 中的 Update-MgUser cmdlet 会更新 Microsoft Graph 中用户对象的属性。

要使用 Update-MgUser cmdlet,必须首先使用 Connect-MGraph cmdlet 连接到 Microsoft 365 租户。连接后,您可以使用 Update-MgUser cmdlet 更新用户属性。

Connect-MgGraph -Scopes User.ReadWrite.All

在本文中,我们将讨论如何在 PowerShell 中使用 Update-MgUser cmdlet 更新用户经理的显示名称。

如何更新用户的显示名称

要更新用户的显示名称,请使用 Update-MgUser cmdlet。此命令使用 -UserId 参数检索要更新的用户,并使用 -DisplayName 参数指定用户的全名。

Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -DisplayName 'Laura k Rubi'

此命令更新指定用户的显示名称。

如何更新用户的联系信息

要更新用户的联系信息(例如城市和国家/地区名称),请使用带有 -City-Country 参数的 Update-MgUser cmdlet 。

Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -City 'Houston' -Country 'United States'

此命令更新 Microsoft Graph 中用户的城市和国家/地区名称。

如何更新用户的部门名称

若要更新 Microsoft Graph 中用户的部门名称,请运行以下命令。

Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -Department 'HR'

此命令更新用户的部门名称。

如何更新用户的职称

若要更新 Microsoft Graph 中用户的职务,请运行以下命令。

Update-MgUser -UserId 'd89e3afc-c554-4607-8748-07b78dc7121a' -JobTitle 'System Administrator'  

此命令将用户的职位更新为“系统管理员”。

结论

希望上述有关如何在 PowerShell 中使用 Update-MgUser cmdlet 更新 Microsoft Graph 中用户对象的属性的文章对您有所帮助。

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

相关链接

新用户管理

获取 MgUser

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

取消回复欢迎 发表评论:

关灯