如何使用 Get-MgContact cmdlet 获取 Microsoft Entra ID 联系人

获取 Microsoft Entra ID 联系人

管理 Microsoft Entra ID 中的联系信息对于 IT 管理员维护有序且高效的目录至关重要。Microsoft Graph PowerShell 中的 Get-MgContact cmdlet 使管理员能够获取 Microsoft Entra ID 联系人对象及其详细信息,如显示名称、电子邮件地址和组织关系。虽然此命令功能强大,但需要脚本知识和手动执行,对于偏好更简单方法的管理员来说不够便捷。ManageEngine ADManager Plus 通过其全面的报告简化了 联系人报告生成

  • ADManager Plus
  • PowerShell
 

使用 ADManager Plus 获取 Microsoft Entra ID 用户

  1. 登录 ADManager Plus 并导航至 Microsoft 365 > Reports > Contact Reports
  2. General Contact Reports 下,点击 Contact List
  3. Microsoft Tenant 下拉列表中选择所需的 Microsoft 365 租户,然后点击 Generate
使用 ADManager Plus 获取 Microsoft Entra ID 联系人
 
 

即时为邮件联系人分配经理。

 
 

计划并自动生成报告。

 
 

在导出前自定义报告以包含特定列。

使用 Get-MgContact cmdlet 列出 Microsoft Entra ID 联系人

前提条件

使用 Get-MgContact cmdlet 前,请确保以下事项:

  • The Microsoft Graph PowerShell module is installed. If not, install it using this script:
    Install-Module Microsoft.Graph -Scope CurrentUser
  • 使用所需权限连接到 Microsoft Graph PowerShell 以获取 Microsoft Entra ID 联系人。
  • 确保您拥有管理 Microsoft Entra ID 联系人的管理员权限。

使用 Get-MgContact cmdlet

以下是如何使用 Get-MgContact cmdlet 从 Microsoft Entra ID 检索联系人详细信息的方法:

Get-MgContact
[-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>]

示例用例和脚本

示例 1:获取特定联系人

Get-MgContact -ContactId "970"

示例 2:获取所有 Microsoft Entra ID 联系人

Get-MgContact

示例 3:检索特定联系人属性

Get-MgContact -ContactId "970" | Select-Object DisplayName, Mail, CompanyName

支持的参数

参数 描述
-ContactId 此参数允许您指定要检索其详细信息的联系人 ID。
-Filter 此参数允许您根据联系人属性筛选结果。
-All 此参数列出 Microsoft Entra ID 中的所有联系人。
-OrgContactId 此参数允许您指定要获取详细信息的组织联系人的唯一标识符。

使用 Graph PowerShell 脚本获取联系人报告的限制

  • Graph PowerShell 学习曲线陡峭,且需要脚本专业知识,难以将任务委派给初级技术人员。
  • 高级筛选和报告需要额外的脚本编写。
  • 缺乏内置的计划选项来自动生成报告。
  • 检索特定联系人详细信息涉及复杂的查询语法,增加了出错风险。

使用 ADManager Plus 进行 Microsoft Entra ID 报告的优势

  • 无脚本报告生成:通过直观的无脚本界面轻松生成报告。
  • 安全委派:允许初级技术人员安全生成报告,无需 PowerShell 专业知识,提高效率与协作。
  • 定制报告:轻松应用筛选、排序数据并自定义报告,免去手动查询语法的麻烦。
  • 自动报告生成:安排报告在预定时间间隔运行,确保无需手动操作即可获得最新洞察。

使用 ADManager Plus 轻松自动化并导出 Microsoft Entra ID 报告

 
  • 获取 Microsoft Entra ID 联系人
  • 使用 ADManager Plus 获取 Microsoft Entra ID 联系人
  • 使用 Get-MgContact cmdlet 列出 Microsoft Entra ID 联系人
  • 使用 Graph PowerShell 脚本获取 Microsoft Entra ID 联系人的限制
  • 使用 ADManager Plus 进行 Microsoft Entra ID 报告的优势
Active Directory管理与报告的一站式解决方案
电子邮件下载链接 Email the ADManager Plus download link