Create HNSC Web application and top site

posted in: HNSC, PowerShell | 0

PowerShell to create the host named site collection web application and top site

This post is step 1 of two steps to get host named site collections off the ground in your SharePoint.

NOTE THIS IS NOT THE BEST RECOMMENDED APPROACH BUT IT WORKS….So if you just want to create HNSC and not understand, then this post is for you.  I am writing a better post that explains using the IP address or a SAN cert, this upcoming weekend, May 10, 2020 and will post a link here once it is done.

In this script you need to edit the following variables, and any references to your domain

$servers

$applicationPool

$serviceAcct

$webApp

$webAppURL

$contentDB

$primarySiteCollectionOwnerAcct

$PrimarySCOwnerEmail

$SecondaryOwnerAcct

$SedondaryOwnerEmail

$webApp0URL

Essentially, you replace wingtip with your domain name, and .com with your tld if you have a different top level domain

Also pay attention to the service account, that it is the correct name

After you run this you need to run the script to create the host named site collections

The script that creates the new host named site collections can be found at this post.