I would like to know how to get all groups of a specific web site using powershell. I do know that all groups are defined at the site collection level but when browsing in a specific web, it only displays groups that are associated with the current web.

So there must be a way to know what is the web associated for a specific group or what are all groups associated with a specific web.

Thanks a lot.

2 Answers 2


I found the solution.

This article helped me out.

$web = Get-SPWeb $webUrl;
$groups = $web.AssociatedGroups;

In SharePoint 2010 the Web Object has different properties to get site groups and web groups.

$web = Get-SPWeb $webUrl
//Gets a collection that contains all the groups in the site collection.
$siteGroups = $web.SiteGroups
//Gets a collection that contains all the groups for the website. This return SPGroupCollection object and listed groups will be assigned security roles assigned in a current site
$webGroups = $web.Groups
//Gets a collection that contains all the groups for the website. This returns all web groups but some group may not have securoty roles assigned.
$webGroups = $web.AssociatedGroups

You can refer the web properties and methods here https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.spweb_properties(v=office.14).aspx

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.