代码之家  ›  专栏  ›  技术社区  ›  bgmCoder

如何获取邮件联系人所属的所有组?

  •  2
  • bgmCoder  · 技术社区  · 7 年前

    此代码将查找特定电子邮件帐户或 mail-user 帐户属于。

    get-group | where-object -FilterScript {$_.Members -contains $user}
    

    但是,在O365中,您可以 mail-contacts 谁不是用户-他们只是用于邮件列表;他们没有一个 windowsliveid ,这样就不会在 $_.Members

    我怎样才能找到所有特定的组 mail-contact 属于谁?

    1 回复  |  直到 7 年前
        1
  •  0
  •   bgmCoder    7 年前

    likeafoxx over in reddit

    $contact = Get-Contact -Identity "<Contact's Name>"
    Get-Group | Where-Object {$_.Members -contains $contact}
    

    显然,如果你赶上了 get-contact get-group $_.members 可以搜索