Monday, April 6, 2015

Create new Host Header Site Collection in a new content database SharePoint 2013

Host-Named Site Collection (HNSC) is actually a means to have a separate DNS for each site collection rather than having all the site collections follow the URL of the web application (path-based site collections). Now you can to have and separate database with PowerShell.

 Download script


Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue
 $webapp = Read-Host "Enter WebApplication URL"
 $dbserver = Read-Host "Enter SQL Server"
 $siteurl = Read-Host "Enter Host Header Site Collection URL"
 $site = Read-Host "Enter Host Header Site Collection Name"
 $language = Read-Host "Enter Language (2074)"
 $dbname = Read-Host "Enter ContentDB name of WebApplication"
 $dbname1 = Read-Host "Enter ContentDB name of HHSC"
 $owner1 = Read-Host "Enter Primary Site Collection Administrator (DOMAIN\UserName)"
 $owner2 = Read-Host "Enter Secondary Site Collection Administrator (DOMAIN\UserName)"
 New-SPContentDatabase -Name $dbname1 -DatabaseServer $dbserver -WebApplication $webapp | out-null
 New-SPSite $siteurl -OwnerAlias $owner1 -SecondaryOwnerAlias $owner2 -ContentDatabase $dbname1 -HostheaderWebApplication $webapp -Name $site -Language $language
 Get-SPContentDatabase -Site $siteUrl | Set-SPContentDatabase -maxSiteCount 1 -WarningSiteCount 0
Write-Host “Site Collection at” $site “has been created in the” $dbname1 “content database” -ForegroundColor Yellow


Create HostA in DNS.
Open IIS Manager, Sites, Edit Bindings on WebApplication, add Site Binding (picture).
Change on all SharePoint servers.
















When you open site in browser choose site template and set up groups for site.

No comments:

Post a Comment