This SharePoint 2016 tutorial explains the fast site collection creation in SharePoint 2016 using PowerShell. The fast site collection creation process improves site collection creation performance.
SharePoint Tutorial Contents
SharePoint 2016 has various new features for developers.
One of the new features of SharePoint 2016 is fast site collection creation feature.
Previously when you are trying to create SharePoint site collection it usually takes time to create a site collection. To reduce this performance issue, in SharePoint 2016 Microsoft provides the fast site collection feature which is supported now by PowerShell only.
You can create the fast site collection using PowerShell only because UI is not supported yet.
On a high level, this works at the SQL Server level which reduces round trips required between SharePoint and SQL Server. It simply copies at the SQL server level directly.
SharePoint 2016 provides few PowerShell commands to work with fast site creation.
Below are PowerShell cmdlets to work with Fast site Creation in SharePoint 2016.
Get-SPWebTemplatesEnabledForSiteMaster
This PowerShell command displays a list of template IDs that are enabled for SharePoint 2016 fast site creation.
PS E:\Users\Administrator> Add-PSSnapin Microsoft.SharePoint.PowerShell
Get-SPWebTemplatesEnabledForSiteMaster
Name | CompatibilityLevel |
SPSPERS#2 | 15 |
SPSPERS#6 | 15 |
SPSPERS#7 | 15 |
SPSPERS#8 | 15 |
SPSPERS#9 | 15 |
SPSPERS#10 | 15 |
When you run the above command, you can see the templated ids enabled for fast site creation.
Enable-SPWebTemplateForSiteMaster
By using this PowerShell command you can enable a template for fast site collection creation in SharePoint 2016.
Suppose you want to enable team site template id for fast site collection creation, then you can use the below PowerShell command.
STS#0 is the template id for the team site. You can check a very good article by Vlad in Absolute-SharePoint to see all the template ids.
Enable-SPWebTemplateForSiteMaster -Template "STS#0" -CompatibilityLevel 15
Once you run the above command you can see the team site template is now enabled for fast site creation.
PS E:\Users\Administrator> Add-PSSnapin Microsoft.SharePoint.PowerShell
Enable-SPWebTemplateForSiteMaster -Template "STS#0" -CompatibilityLevel 15
Get-SPWebTemplatesEnabledForSiteMaster
Name | CompatibilityLevel |
SPSPERS#2 | 15 |
SPSPERS#6 | 15 |
SPSPERS#7 | 15 |
SPSPERS#8 | 15 |
SPSPERS#9 | 15 |
SPSPERS#10 | 15 |
STS#0 | 15 |
Get-SPSiteMaster
This command will display the site master information, it is something like this information will be used when we create a site collection using a fast site creation process.
Get-SPSiteMaster -ContentDatabase WSS_Content
By default it will provide information like below when you run the above command:
PS E:\Users\Administrator> Add-PSSnapin Microsoft.SharePoint.PowerShell
Get-SPSiteMaster -ContentDatabase WSS_Content
ContentDatabase : SPContentDatabase Name=WSS_Content
SiteId : bb743227-37ac-404c-8ab3-e6e293313b38
TemplateName : SPSPERS#10
Language : 1033
CompatibilityLevel : 15
FeaturesToActivateOnCopy : {0ee1129f-a2f3-41a9-9e9c-c7ee619a8c33|00000000-0000-0000-0000-000000000000|;,
f661430e-c155-438e-a7c6-c68648f1b119|00000000-0000-0000-0000-000000000000|;,
e9c0ff81-d821-4771-8b4c-246aa7e5e9eb|00000000-0000-0000-0000-000000000000|;,
fa8379c9-791a-4fb0-812e-d0cfcac809c8|00000000-0000-0000-0000-000000000000|;…}
It looks like below:
New-SPSiteMaster
We can use this PowerShell command to new site master using any template. As for our requirement we will create a site master for the team site template.
New-SPSiteMaster -ContentDatabase WSS_Content -Template STS#0
This command will take some time to add to the site master. After this if you will run Get-SPSiteMaster PowerShell command you can see our team site template will be added to the site master like below:
PS E:\Users\Administrator> Add-PSSnapin Microsoft.SharePoint.PowerShell
Get-SPSiteMaster -ContentDatabase WSS_Content
ContentDatabase : SPContentDatabase Name=WSS_Content
SiteId : ab6df6d4-6b48-4a54-97a8-4dac0f23443c
TemplateName : STS#0
Language : 1033
CompatibilityLevel : 15
FeaturesToActivateOnCopy : {4c42ab64-55af-4c7c-986a-ac216a6e0c0e|00000000-0000-0000-0000-000000000000|;,
8581a8a7-cf16-4770-ac54-260265ddb0b2|00000000-0000-0000-0000-000000000000|;,
3bae86a2-776d-499d-9db8-fa4cdc7884f8|00000000-0000-0000-0000-000000000000|;,
3cb475e7-4e87-45eb-a1f3-db96ad7cf313|00000000-0000-0000-0000-000000000000|;…}
ContentDatabase : SPContentDatabase Name=WSS_Content
SiteId : bb743227-37ac-404c-8ab3-e6e293313b38
TemplateName : SPSPERS#10
Language : 1033
CompatibilityLevel : 15
FeaturesToActivateOnCopy : {0ee1129f-a2f3-41a9-9e9c-c7ee619a8c33|00000000-0000-0000-0000-000000000000|;,
f661430e-c155-438e-a7c6-c68648f1b119|00000000-0000-0000-0000-000000000000|;,
e9c0ff81-d821-4771-8b4c-246aa7e5e9eb|00000000-0000-0000-0000-000000000000|;,
fa8379c9-791a-4fb0-812e-d0cfcac809c8|00000000-0000-0000-0000-000000000000|;…}
New-SPSite
Now we can create a site collection from site master in SharePoint 2016 by using the PowerShell command below:
New-SPSite http://mypc/sites/MyFastSiteFromPowerShell -ContentDatabase "WSS_Content" -CompatibilityLevel 15 -CreateFromSiteMaster -Template "STS#0" -OwnerAlias"MySP\Administrator"
This will create the site collection in less time.
You can visit the site url to see the site collection created successfully.
Disable-SPWebTemplateForSiteMaster
Microsoft also provides below command to disable site template from site master.
Disable-SPWebTemplateForSiteMaster -Template STS#0
The above command will disable team site template from site master.
Remove-SPSiteMaster
This PowerShell command will remove site master from the content database.
Remove-SPSiteMaster -ContentDatabase "WSS_Content" -SiteId
SiteId: You can get the SiteId by running Get-SPSiteMaster -ContentDatabase WSS_Content command.
You may like following SharePoint tutorials:
- Get Service Applications using PowerShell in SharePoint 2013/2016
- Delete content type from SharePoint list using PowerShell
- How to activate publishing feature in SharePoint 2013/2016 using PowerShell Script
- Change Site Collection URL in SharePoint 2013/2016 using PowerShell
I hope this SharePoint 2016 tutorial helps to know about SharePoint 2016 Fast Site Collection Creation using PowerShell.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com