SharePoint PowerShelll: difference between Groups and SiteGroups
SPWeb object has 2 different properties for work with groups. There are Grops and SiteGroups. Inspite of the fact that they look very similar, they are different.
Property "SiteGroups" gets a collection that contains all the groups in the site collection. Using this property you will receive all the groups in Site Collection, even if they don’t have permissions to site object. These groups can be used by custom SharePoint application or, for example, for sending messages via SharePoint workflow.
Property "Groups" returns only a list of groups for which permissions have been set on SPWeb.
The main difference is that "SiteGroups" returns all the groups, even hidden groups.
$site = Get-SPSite http://mysharepointportal/mysite
$spweb = $site.OpenWeb()
$allgroups = $spweb.SiteGroups
$permGroups = $spweb.Groups