How to Create Default Groups in SharePoint Site?

Problem:
The default SharePoint groups are automatically created when you create a new site collection through SharePoint Web UI. But, when you create SharePoint sites programmatically or with PowerShell (E.g., New-SPSite or New-SPWeb), The default site groups (such as Visitors, Members, Owners) are not created automatically!

Default groups creation from UI: You can get the default group page from SharePoint UI by navigating to: https://your-sharepoint-site.com/_layouts/permsetup.aspx . Enter group details and hit “Save”.

How to Create Default Site Groups in SharePoint

How to create the default SharePoint groups?
You have to call the method: SPWeb.CreateDefaultAssociatedGroups explicitly to create default user groups in SharePoint.

Create Default User Groups programmatically using PowerShell:

To provision the default site groups, use this PowerShell:

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

#Variables for Site collection
$SiteURL ="https://intranet.crescent.com"
$Site = Get-SPSite $SiteURL

#get the Root Web object
$RootWeb = $Site.RootWeb

$GroupOwner = "i:0#.w|global\salaudeen" 
$RootWeb.CreateDefaultAssociatedGroups($GroupOwner, "", $RootWeb.title)

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

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