1

I am using SharePoint 2013 and i want to create some spweb from a site template...

I have created a site and added my desired content and i saved that site as template, then went to solution gallery and downloaded the .wsp file.

Now, i need to create a new site collection with some subsites which are based on that template, and to do so i think need to upload the .wsp file to the solution gallery the way i can find the newly saved template, and i need to do that from PowerShell !

I tried 2 ways,

First,

I tried to add-spsolution and install-spsolution like following

Add-SPSolution -LiteralPath $SPIntranetTemplateFilePath
Install-SPSolution -Identity SPITemplateFile.wsp -CompatibilityLevel 15 -force

but i don't find the .wsp in the solution gallery and the template is not in templates list...

I tried to use Install-SPWebTemplate but this command is not recognized as a cmdlet in my PowerShell (I have added Add-PSSnapin Microsoft.SharePoint.PowerShell)

I have used this too

## SharePoint DLL 
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") 

Can anyone help me to use my WspFile the way i can create subsites based on my template ?

Thanks

1

You have two ways to add the template into a site.

  1. Use the UI and upload it (directly going to solution gallery)
  2. or try to use these Add-SPUserSolution and Install-SPUserSolution.
  • As i mentioned it i want it from powerShell then I already mentioned too that i tried Add-SPSolution and InsTall-SPSolution and did not work... can help me more and tell me why it does not work? – Haithem KAROUI Aug 12 '14 at 13:33
  • my commands are different then you already tried...please try those...add-spusersolution – Waqas Sarwar MVP Aug 12 '14 at 13:37
  • the wsp file is added to the solution gallery and the template appears in custom templates list (on teh U.I) BUT does not figure on the templates list when i do Get-SPWebTemplate in PowerShell... why do you think is this heppening? – Haithem KAROUI Aug 12 '14 at 14:07
  • 1
    that's what i believe, saved as template(wsp) fall into the sandbox solution... – Waqas Sarwar MVP Aug 12 '14 at 14:41
  • 1
    @prasadwt You can use something like $template= $site.GetWebTemplates($locale)|?{$_.Title -eq "templateTitle"}. This can then be used via $template parameter in the $site.AllWebs.Add()-Method – Urs Aug 14 '17 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.