How to list all the distribution lists, M365 groups a user is a member of?

Pamu 86 Reputation points
2021-06-23T04:46:18.45+00:00

Hi everyone,

Is there a specific PowerShell script or any other method that I can use to list down all the Distribution List, Microsft365 Groups a specific member is a part of?

A script to list down all the Shared-Mailboxes a user has permission to would be appreciated too.
Like something that would help in an user off-boarding process?

Thanks in advance for the help!!!

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,148 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,322 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,343 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,297 questions
{count} votes

2 answers

Sort by: Most helpful
  1. AmanpreetSingh-MSFT 56,301 Reputation points
    2021-06-23T12:09:56.077+00:00

    Hi @PamudithaMadushanka-8226 ·

    If you are using Azure AD user account, you can use below Graph Call:

    • Open Graph Explorer and sign in with user administrator or global administrator account.
    • Run below call:

    GET https://graph.microsoft.com/v1.0/users/{id}/memberOf

    Permissions required :
    Delegated permissions - User.Read, GroupMember.Read.All, Directory.Read.All, Directory.ReadWrite.All, Directory.AccessAsUser.All

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    2 people found this answer helpful.
    0 comments No comments

  2. Vasil Michev 94,131 Reputation points MVP
    2021-06-23T08:12:34.547+00:00

    There are plenty examples available online, here's one of mine: https://www.michev.info/Blog/Post/2250/generating-a-report-of-users-group-membership-memberof-inventory
    If you want a quick one-liner instead, use this:

    Get-Recipient -Filter "Members -eq 'CN=user,OU=domain.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR03A001,DC=prod,DC=outlook,DC=com'"
    

    where you need to provide the DistinguishedName of the user.

    1 person found this answer helpful.