Press ESC to close

Export the users from an Office 365 security group with PowerShell

Thanks to Nic Watters I found an useful Office 365 PowerShell scripts to extract the members from an Office 365 security group with PowerShell. Here are the instructions:

List members of a security group

  1. Display  the security group objectid

Get-MSOLGroup

  1. Copy the 32 digit objectid code of the security group you want to check members.
  2. Modify the following script to add the copied security group objectid. The following script will export members of a security group members to csv.

Get-MsolGroupMember -groupObjectid ‘xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’ | Select DisplayName,EmailAddress,GroupMemberType | Export-csv C:\tools\security-group-members.csv

Thanks Nic!

Jasper Oosterveld

My name is Jasper Oosterveld. I am a Microsoft MVP, Data Security & Microsoft 365 Consultant based in the Netherlands. I’ve spent the last decade helping organizations tackle complex challenges around Governance, Adoption and Data Security with Microsoft Purview. My mission? To empower companies to protect their data and streamline collaboration in Microsoft 365, all while keeping governance and adoption at the forefront.

Comments (3)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.