Answered by:
Create Site Collection based on Custom Site Template

Question
-
Hi,
I have created a site collection where I have activated few publishing features and PowerPivot related features for BI using below link.
http://blogs.msdn.com/b/querysimon/archive/2012/11/26/installing-the-bi-features-of-sharepoint-2013.aspx
After setting this site with required features I added few PowerView Reports(.bism,.rdlx) and Custom List and saved this site as a Template. "MyCustomSiteTemplate"
Now I need to create another site collection based on this new custom site template using PowerShell script. Using CA UI it's straight forward but I would like to achieve this using PowerShell Script.
From my understanding steps would be as follows:
1. Create new Site collection
2. Upload .wsp(site template) to new site's soultion gallary.
3. Activate features which are activated in custom template
4.Apply Custom Template to Site collection.
But I am not sure how I can do this using PowerShell script. I found below link which is based on the same question.
http://social.technet.microsoft.com/Forums/en-US/059cdf90-d41c-4d32-9d3d-25dce19ec2b1/unable-to-apply-a-new-site-template-to-a-new-site-collections-root-web?forum=sharepointadminprevious
Please help!!
Answers
-
Hi SGMSSharePoint,
First, save the web as template, then in the solution gallery, we can find the saved template wsp file. Download the file to local folder.
Site collection doesn’t apply any web template, it is the rootweb in the site collection that use the template, we can first create the site collection without setting the rootweb template, then upload the template file to the solution gallery, activate the feature, then apply web template to the rootweb.
The following article contain a c# code sample to create site collection using custom web template, you can change it to PowerShell code:
http://www.microsofttechnology.net/2012/05/how-to-create-sites-and-site.htmlCreate a SharePoint Site Collection with a custom Template using PowerShell:
http://absolute-sharepoint.com/2012/06/create-a-sharepoint-site-collection-with-a-custom-template-using-powershell.htmlThanks,
Qiao Wei
TechNet Community Support- Proposed as answer by Ramakrishnaraja Tuesday, March 25, 2014 3:34 AM
- Marked as answer by SGMSSharePoint Tuesday, March 25, 2014 8:43 AM
All replies
-
Try below
Add-spsolution -literalpath "Path to your WSP"
Install-spsoluton "custom.wsp" -gac
Or you can follow below:
-
Thanks Inderjeet. I have already tried with 1st link and I am able to see new custom template deployed to Farm solutions. But at the time of creating site collections it's not available in custom tab nor available via PowerShell script. Also, I am looking for automating this using PowerShell Script and not through CA UI.
-
Hi SGMSSharePoint,
First, save the web as template, then in the solution gallery, we can find the saved template wsp file. Download the file to local folder.
Site collection doesn’t apply any web template, it is the rootweb in the site collection that use the template, we can first create the site collection without setting the rootweb template, then upload the template file to the solution gallery, activate the feature, then apply web template to the rootweb.
The following article contain a c# code sample to create site collection using custom web template, you can change it to PowerShell code:
http://www.microsofttechnology.net/2012/05/how-to-create-sites-and-site.htmlCreate a SharePoint Site Collection with a custom Template using PowerShell:
http://absolute-sharepoint.com/2012/06/create-a-sharepoint-site-collection-with-a-custom-template-using-powershell.htmlThanks,
Qiao Wei
TechNet Community Support- Proposed as answer by Ramakrishnaraja Tuesday, March 25, 2014 3:34 AM
- Marked as answer by SGMSSharePoint Tuesday, March 25, 2014 8:43 AM
-