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))"
    }
}

arrow
arrow
    創作者介紹
    創作者 helloworld 的頭像
    helloworld

    Hello World

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