I'm trying to get all members of SharePoint 'Owners' and 'Members' groups across sites in my tenant. When I loop through the list of sites and use the following command for each site:

Get-SPOUser -Limit All

I get the groups and any users granted access to the site without being in a group but I don't get the members of the groups themselves.

I'm not able to pass the group name to the command below as the Members and Owners groups in my site aren't always called Owners or Members. The sites use different languages and the group names reflect this. So I'm not able to programmatically check the owners and members for each site.

Get-SPOUser -Group "RandomName" -Limit All

Is there a way to get owners and members of a site programmatically when you can't pass the group name to the Get-SPOUser command. I couldn't find a property of the groups that would identify them as owners or members and use this property to pass the group to the Get-SPOUser command

Note: Due to restrictions, I'm unable to use the PnP PowerShell module.

2 Answers 2


As per the documentation of SharePoint online PowerShell, Get-SPOUser command returns:

The SharePoint Online user or security group accounts that match a given search criteria

To get the SharePoint groups using SharePoint online PowerShell, you have to use the Get-SPOSiteGroup command.


  1. Get-SPOUser
  2. Get-SPOSiteGroup
  • Hi, I understand the commands I need to use. My issue is the group names don't have a consistent format so I can't apply any logic when looping through the sites. Which is why my question is how to get the members of an SPO site when you cant be certain of the group name or alternatively do the members and owners group have a property that would identify them as such other than their names
    – Mubashir
    Commented Apr 4, 2023 at 11:39
  • That you might not be able get using these commands. check if it is possible to get using Get-SPOSite. It might be available at web object level. There are related APIs and properties for that like: /_api/web/AssociatedMemberGroup and /_api/web/AssociatedOwnerGroup. Commented Apr 4, 2023 at 11:52
  • Thanks again, how would I go about accessing those properties? Is that using the GRAPH API?
    – Mubashir
    Commented Apr 4, 2023 at 14:37
  • Those are SharePoint REST API endpoints (given just as example). Check if you access those using Get-SPOSite. Commented Apr 4, 2023 at 15:11

I use Get-PnPGroup It has options "-AssociatedOwnerGroup", "-AssociatedMemberGroup" that I believe do exactly what you need.

The other approach would be to get all SharePoint groups and check permissions - e.g. "Full Control" would give you "Site Owners" group

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.