Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The following is based on the Exam Ref 70-331: Core Solutions of Microsoft SharePoint Server 2013 by Troy Lanphier.
Check out Kirk Evan's blog for more background behind HNSC - http://blogs.msdn.com/b/kaevans/archive/2012/03/27/what-every-sharepoint-admin-needs-to-know-about-host-named-site-collections.aspx
#Build a web application and place an empty site collection in it, a site collection with no site, e.g. pick site later or create with powershell as follows:
$applicationPool = "SharePoint - 443"
$ServiceAcct = "domain\svcapp"
$svcacctmail = "svcapp@domain"
$WebApp = "SharePoint HNSC Web Application"
$webAppURL = "https://ws2013app/"
$contentDB = "WSS_Content_TopSiteEmpty"
#If creating for SharePoint 2013, sent the claims authentication provider by calling the new-spauthenticationprovider cmdlet into a variable as: $Provider = New-spauthenticationprovider
#Create the example web application, as mentioned above, either with gui, and pick later, or
New-SPWebApplication -ApplicationPool $applicationPool -ApplicationPoolAccount $serviceAcct -Name $WebApp -Port 443 -databaseName $contentDB -securesocketslayer
#If doing for 2013
New-SPWebApplication -ApplicationPool $applicationPool -ApplicationPoolAccount $serviceAcct -Name $WebApp -Port 443 -AuthenticationProvider (new-spauthenticationprovider) -databaseName $contentDB -secureSocketsLayer
#Now that the web app is there, build the empty site collection
$primarySiteCollectionOwnerAcct = "domain\someName"
$PrimarySCOwnerEmail = "webcontent@domain"
New-SPSite -URL $webAppURL -OwnerAlias $primarySiteCollectionOwnerAcct -OwnerEmail $PrimarySCOwnerEmail
#Build some content databases
new-SPContentDatabase -Name $HNSC1DB -WebApplication $WebApp -WarningSiteCount 0 -MaxSiteCount 1
#Now build some HNSC's
$HNSC1Name = "Hockeytown Usa"
$HNSC1URL = "https://hockeytown.domain.com"
$HNSC1DB = "WSS_Content_HockeyTown"
New-SPSite -url $HNSC1URL -HostHeaderWebApplication $webAppURL -Name $HNSC1Name -ownerAlias $PrimarySiteCollectionOwnerAcct -owneremail $PrimarySCOwnerEmail -contentDatabase $HNSC1DB
$HNSC2Name = "Baseball city"
$HNSC2URL = "https://baseball.domain.com"
$HNSC2DB = "WSS_Content_HaveYouSeenMyBaseball"
New-SPSite -url $HNSC2URL -HostHeaderWebApplication $webAppURL -Name $HNSC2Name -ownerAlias $PrimarySiteCollectionOwnerAcct -owneremail $PrimarySCOwnerEmail -contentDatabase $HNSC2DB