Find all the Office 365 Groups a user is a Member of with PowerShell

Find all the Office 365 Groups a user is a Member of with PowerShell

Whether you want to do some reports or debugging, you might need to quickly find out what Office 365 Groups a user is a member or Owner of! You could go in the user’s profile, see all the groups, find out which ones are Security, which ones are Distribution Groups, and which ones are Office 365 Groups. or you could do an easy PowerShell cmdlet!

Find all the Office 365 Groups a user is a Member of with PowerShell

Since we will be playing with Exchange Online, you first need to connect to Exchange!

 

Next up, I will save the E-mail of the person I am looking for in a variable called UserEmail, and use the GetMailbox cmdlet to save the Mailbox object of that user in a variable called Mailbox.

 

After we have this information, we can use the Get-UnifiedGroup PowerShell cmdlet, together with the Get-UnifiedGroupLinks cmdlet to find which groups this user is a member of!

To find all the Office 365 Groups a user is a member of, we would use the following cmdlet:

We then have all those groups stored in a variable, and we can use them as we wish inside PowerShell!

Find all the Office 365 Groups a user is a Member of with PowerShell

To find all the Office 365 Groups a user is an owner of, we would use the following cmdlet:

As you see, the only thing that changed is the -LinkType parameter from Members to Owners! We now also have all those groups stored in a variable to use as we wish in PowerShell!

Find all the Office 365 Groups a user is a Member of with PowerShell

 

Follow me on Social Media and Share this article with your friends!

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
5/5 (5)

Please rate this

 
Comments

No comments yet.

Leave a Reply