In a previous post, “SharePoint 2013 Host Named Site Collections over SSL”, I outlined creating a HNSC however it appears when creating a site collection through PowerShell (New-SPSite) instead of using Central Administration the default groups (Visitors, Members, Owners) are missing. For example, if I navigate to Site Settings –> Site Permissions on a Site Collection created with PowerShell it’s clear that the default groups are missing:
Create Default Groups in the UI
One way to add these groups after the fact is to navigate to the permsetup.aspx page located at:
- i.e. https://teams.2008r2.local/_layouts/15/permsetup.aspx
This will bring up a page titled “Set Up Groups for this Site” and will allow you to not only create the “Visitors”, “Members”, and “Owners” groups, but will also provide the ability to setup the initial group membership as well.
Now if I return to Site Settings –> Site Permissions I’ll notice that the default groups are present.
Create the Default Groups in PowerShell
Looking back at the original article I should have added some logic to create default groups in my script. There’s a SPWeb.CreateDefaultAssoicatedGroups method that can be used for this purpose and is outlined on MSDN. Below is a PowerShell code sample that can be used to create the default groups:
# Create the Default Groups (Visitor, Member, and Owners) $url = “http://teams.2008r2.local” $PrimaryLogin = “2008r2\SPInstall” $SecondaryLogin = “2008r2\Jason” $web = Get-SPWeb $url $web.CreateDefaultAssociatedGroups ($PrimaryLogin, $SecondaryLogin, “”)