power shell 可以列出exchange online 某個通訊群組包含哪些成員
但無法直接從個人帳號反推屬於哪些通訊群組
需透過迴圈來實現


Connect-ExchangeOnline

userMailbox = "個人信箱"

Get-DistributionGroup ForEach-Object {
    group = _
    groupMembers = Get-DistributionGroupMember -Identity group.Identity -ResultSize Unlimited
    userInGroup = groupMembers Where-Object { _.PrimarySmtpAddress -eq userMailbox }

    if (userInGroup) {
        Write-Host "userMailbox -> (group.DisplayName) ((group.PrimarySmtpAddress))"
    }
}

文章標籤
全站熱搜
創作者介紹
創作者 helloworld 的頭像
helloworld

Hello World

helloworld 發表在 痞客邦 留言(0) 人氣(0)