You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何从已加入域的机器通过UPN/用户名查询Active Directory用户邮箱

在已加入域的机器上通过UPN/用户名查询AD用户邮箱地址

以下是几种实用的查询方法,适用于已加入Active Directory域的Windows机器:

方法1:PowerShell(推荐)

需确保安装RSAT-AD-PowerShell模块(域控制器默认预装,成员机器可通过Install-WindowsFeature RSAT-AD-PowerShell安装)。

  • 按用户主体名称(UPN)查询:

    Get-ADUser -Filter "UserPrincipalName -eq 'john.doe@contoso.com'" -Properties EmailAddress | Select-Object Name, UserPrincipalName, EmailAddress
    

    若要批量匹配某域名下所有用户,可改用-like:

    Get-ADUser -Filter "UserPrincipalName -like '*@contoso.com'" -Properties EmailAddress | Select-Object Name, UserPrincipalName, EmailAddress
    
  • 按用户名(sAMAccountName)查询:

    Get-ADUser -Filter "sAMAccountName -eq 'jdoe'" -Properties EmailAddress | Select-Object Name, UserPrincipalName, EmailAddress
    

方法2:命令行工具(dsquery/dsget)

直接使用系统自带命令行工具,无需额外模块:

  • 按UPN查询:

    dsquery user -upn john.doe@contoso.com | dsget user -email
    
  • 按用户名查询:

    dsquery user -samid jdoe | dsget user -email
    

    注:查询结果为空时,可能是用户未配置邮箱或参数输入错误。

方法3:图形化工具(AD用户和计算机)

适合不熟悉命令行的场景:

  1. 用dsa.msc命令快速启动Active Directory用户和计算机
  2. 左侧导航栏选中目标域,点击顶部工具栏的「搜索」按钮
  3. 在搜索对话框中:
    • 按UPN查询:选择「用户主体名称」字段,输入完整UPN
    • 按用户名查询:选择「用户名」字段,输入目标用户名
  4. 找到用户后右键选择「属性」,在「常规」选项卡查看「电子邮件」字段

内容的提问来源于stack exchange,提问作者Sherwin Dourado

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 04:43:22