Setting the default 3 groups in SharePoint from PowerShell

I ran into this today –

Tagging on /_Layouts/permsetup.aspx to a site’s url brings up a list of the 3 standard groups for a site:

  • one for visitors
  • one for members
  • one for owners

Today when I tried to change one through the GUI, It threw an error.
The ULS logs were a mess, and not wanting to loose a day opening a case with MS I tried PowerShell.

The solution is fairly easy.
Grab a pointer to the web in question with:

$web = get-spweb http://www.yoururl.com/sites/MainSite/subsite

You can see all the web’s properties with:

$web | fl

The 3 that we’re interested in are:

  • AssociatedVisitorsGroup
  • AssociatedMembersGroup
  • AssociatedOwnersGroup

We can set these with PowerShell easily:

$web.AssociatedVisitorsGroup = $web.SiteGroups["Nameofthegroup"]
$web.update()

Leave a Reply