Migrating to SharePoint Host Name Site Collections 2
After the creation of host names site collections as per the script mentioned in my previous article, you might find the need to create managed path and have separate site collections for them. [Note the technet article on managed path Host Name Site Collections as it’s different than managed path under Path-based site collections http://technet.microsoft.com/en-us/library/cc288637.aspx#section5 ]
The script to create a managed path under a host named site collection and creating a site collection under it are as follows:
$hostHeaderWebApp = "http://<WebAppName>:<WebAppPort>"
$ManagedPathLocation = "sites"
$ManagedHostNamedSiteCollection = "http:// <URL of Host Name Site Collection>/Sites/TestManaged"
New-SPManagedPath $ManagedPathLocation -HostHeader
New-SPSite $ManagedHostNamedSiteCollection -OwnerAlias <OwnerDomainAccount> -HostHeaderWebApplication $hostHeaderWebApp -Template $webTemplate