No one has responded to this discussion for at least a year, so this information may be out of date. If you're looking for information about this topic, please search for a more recent discussion or post a new question.

Get list of distribution groups that user is a member of

  • 4 Followers
  • 9 Replies |
  • This post has 0 verified answers |
Answered (Not Verified) This question has suggested answer(s)
How can I use PowerShell to get a list of distribution groups that a user is a member of?  It is too cumbersome to open up each list and view the membership.  Thanks.
  • Post Points: 20
All Replies
  • Hi Vgauthier,

    As I understand, you want to know the distribution groups (DG) which a user is a member of.

    If so, in Windows PowerShell, we can use the cmdlet Get-DistributionGroupMember -Identity Distribution Group to get members of one distribution group currently.

    Meanwhile, in Outlook Web Access (OWA), please login OWA>Options>See all options>Group. We can see the DG which the user is a member of.

    In additional, in this case, you may use some scripts to query the DG which a user is a member of in PowerShell. For detailed scripts, I sincerely suggest you post the detailed requirement in a new thread at PowerShell forum via the following link.
    http://social.technet.microsoft.com/Forums/en/winserverpowershell/

    Thanks for understanding.

    Thanks,
    Eric Sun

    • Top 100 Contributor
    • Post Points: 0
    Suggested by
  • I've looked in the forums but it seems as the only query samples I can find are for finding users in groups in a domain. I am trying to find which distribution groups an employee is a member of in my Exchange Online environment.

    • Not Ranked
    • Post Points: 0
  • Hi Vgauthier,

    Thanks for your update.

    In Office 365, the user can login Outlook Web Access (OWA)>Options>See all options>Group, then he/she can see all the distribution groups which the user is a member of. Just as the screen shot shows in my last post.

    I understand that you are looking for a way to find out all Distribution Groups the specific user belongs to using PowerShell. Actually, after some research, I do find what you need is available. However, it needs a script which is beyond our support. Thus we recommend you to post the question as a new thread at our PowerShell forums, which specifically targets at programming issues related to PowerShell. We are sure there you can find more information and get more professional assistance.
    You may achieve the forum via the link below:
    http://social.technet.microsoft.com/Forums/en/winserverpowershell/

    Thanks a lot for your time and efforts. Thanks for your understanding.

    Thanks,
    Eric Sun

    • Top 100 Contributor
    • Post Points: 0
    Suggested by
  • Hi Eric

    With regards to the GUI suggestion above, isn't this only for the groups that the logged in user belongs to?

    I have previously found that as admin in OWA I can "manage another user" and tell what's groups they belong to that way. As opposed to go through each group. I blogged this with screenshots but in Feb 2012 - www.alpineinteractive.co.uk/.../office-365-how-to-check-which-groups-a-user-belongs-to and I hope its ok if I link to a few other IT support topics there.

     

    Many thanks

     

    Steve Collins

    Alpine Interactive

    IT Support London

    • Not Ranked
    • Post Points: 0
    Suggested by
  • Hi Steve 365,

    Thanks for the information of the issue shared. Yes, that GUI only displays the groups that the login user belongs to. We highly appreciate your time and efforts on the issue.

    In additional, if you have any questions about using Office365, you can post them here/in the forum. It is always our pleasure to be of assistance.

    Thanks,
    Eric Sun

    • Top 100 Contributor
    • Post Points: 0
  • After some additional searching in the forums, I was able to find a PowerShell script that does exactly what I need.  I am sharing it here.  Thanks for your help.

    $User = read-host -Prompt "User Name"

    $user_dn = (get-mailbox $user).distinguishedname

    "User " + $User + " is a member of the following groups:"

    foreach ($group in get-distributiongroup -resultsize unlimited){

    if ((get-distributiongroupmember $group.identity | select -expand distinguishedname) -contains $user_dn){$group.name}

    }

    • Not Ranked
    • Post Points: 0
  • Hi Vgauthier,

    I’m glad to hear that you have resolved the issue, and thanks for the information of the issue shared. We highly appreciate your time and efforts on the issue.

    If you have any questions about using Office365, you can post them here/in the forum. It is always our pleasure to be of assistance.

    Thanks,
    Eric Sun

    • Top 100 Contributor
    • Post Points: 0
  • Vgauthier,

    I've managed to get it working for all users.

    Please use the link below to see my solution:

    community.office365.com/.../74858.aspx

    [ ]'s

    • Not Ranked
    • Post Points: 0
  • Hi Vandrey,

    Thanks for sharing the information. We highly appreciate your time and efforts on the issue.

    If you have any questions about using Office365, you can post them here/in the forum. It is always our pleasure to be of assistance.

    Thanks,
    Eric Sun

    • Top 100 Contributor
    • Post Points: 0
Page 1 of 1 (10 items)