Find all the Distribution Groups a user is a member of with PowerShell in Office 365

Find all the Distribution Groups a user is a member of with PowerShell in Office 365

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

Find all the Distribution 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 Username of the person I am looking for in a variable called Username

And then, I will use this cmdlet which will get all the Distribution Groups in my tenant, and then find the ones where my username is in the members! (This assumes your e-mail address is the same as the username! If that’s not the case, you can simply put the e-mail in the UserName variable and it will work!)

You can now either Display it , or do another action such as removing the user from all of them!

Find all the Distribution Groups a user is a member of with PowerShell in Office 365

That’s it! As you see this is really an quick and easy PowerShell snippet!

 

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.
4.57/5 (7)

Please rate this

 
Comments

No comments yet.

Leave a Reply