Hi @Terry Chan ,
We should use internal name of a site template after parameter -Template
when using New-SPSite
command. This means we need to deploy the site template as a farm solution to SharePoint before executing the command. There is a detailed article about how to achieve this, please take a reference to it: How to Build a Site Collection Template from A Web Template in SharePoint 2010. Although this article is based on SharePoint 2010 environment, it works perfectly for SharePoint 2016 as per my test.
After completing this, you will find your site template can be seen under custom section on the Create Site Collection page, we need to retrieve its internal name using F12 developer tools. As shown in the below screenshot, the value of tag <option> {0A2E4A08-75F5-4184-977E-A5C9877BD466}#testTemp
is the internal name of my test template( testTemp
)
Then I created a site collection based on the testTemp
template using the below powershell.
$template = Get-SPWebTemplate "{0A2E4A08-75F5-4184-977E-A5C9877BD466}#testTemp"
New-SPSite 'http://sp/sites/4test' -OwnerAlias "CONTOSO\aministrator" -Template $template -language 1033 -contentdatabase WSS_Content
Hope this may help. Please feel free to let me if you have any confusion while following the steps in that article.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.