Click here to Skip to main content
13,289,242 members (59,875 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 27 Jun 2014

How to Create Default Groups in SharePoint 2013 Host-Name Site Collection?

, 27 Jun 2014
Rate this:
Please Sign up or sign in to vote.
How to create default groups in SharePoint 2013 Host-Name Site Collection?

What is Host-Named Site Collection?

Host-named site collections enable you to assign a unique DNS name to site collections. For example, you can address them as and This enables you to deploy many sites with unique DNS names in the same web application. It also enables hosters to scale an environment to many customers. If you do not use host-named site collections, your SharePoint web application will contain many path-based site collections that share the same host name (DNS name). For example, Team A has a site collection at, and Team B has a site collection at

You can read more about the Host-named site collection architecture and deployment in SharePoint 2013 here. This article has listed a very good comparison of host-name site collections to the path based site collections. However, one of the key advantages which host-named site collection offers is the transparent experience to the end users which was difficult to achieve in earlier versions of SharePoint. Till SharePoint 2010, the only way to have a dedicated URL mapping was on a Web Application level through alternate access mapping.

It should be noted that there is no user interface to create a host-named site collection from SharePoint 2013 Central administration and is possible only via PowerShell command, which is not very complex either. Below example shows how to create a host-name site collection which can be accessed via the DNS entry

Add-PSSnapin Microsoft.SharePoint.PowerShell 

$currentUser = "$env:USERDOMAIN\$env:USERNAME" 
$siteCollectionUrl = ""
$siteCollectionName = "Manas Dev Site"
$webApplicationUrl = "http://manas"

New-SPSite -Url $siteCollectionUrl -OwnerAlias $currentUser 
-Name $siteCollectionName -Language 1033 -HostHeaderWebApplication $webApplicationUrl -Template sts#0

Create Default Groups in a Host-Named Site Collection

However, when you use the above script to create a host-named site collection, it does not create the default groups (such as Owners, Members and Visitors) which are available if the site collection is created using the Central Administration user interface.

Host Named Site Collection

Look at the image above and you can see the groups are missing. But the good news is that it is still possible to create the default groups using a couple of lines of script.

Add-PSSnapin Microsoft.SharePoint.PowerShell 

$currentUser = "$env:USERDOMAIN\$env:USERNAME" 
$siteCollectionUrl = ""
$siteCollectionName = "Manas Dev Site"
$webApplicationUrl = "http://manas"

New-SPSite -Url $siteCollectionUrl -OwnerAlias $currentUser 
-Name $siteCollectionName -Language 1033 -HostHeaderWebApplication $webApplicationUrl -Template sts#0

$web = Get-SPWeb $siteCollectionUrl
$web.CreateDefaultAssociatedGroups($currentUser, "", "")

What you need to do is call the CreateDefaultAssociatedGroups once your site collection has been created. And this will ensure that the default groups are created for the specified site collection.

Host Named Site Collection_With Groups

Update Hosts File (on Local Development Environment)

If you want to create a host-named site collection on your development environment, you might need to update your local host file to create an entry for the specified URL. In a real test or production environment, you would have an actual DNS VIP entry which you can use to redirect to your site collection. So, for example:

# localhost name resolution is handled within DNS itself.
#       localhost
#	::1             localhost

This post How to create default groups in SharePoint 2013 Host-Name Site Collection? written by Manas Bhardwaj appeared first on Manas Bhardwaj's Stream.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Manas Bhardwaj
Netherlands Netherlands

Read my personal blog at

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171207.1 | Last Updated 27 Jun 2014
Article Copyright 2014 by Manas Bhardwaj
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid