0
votes

I have a site on SharePoint Online and I have saved it as template. Then I would like to create another site collection using this template. However, I cannot find the template from PowerShell command "Get-SPOWebTemplate". I would to know how to make the template in PowerShell command "Get-SPOWebTemplate" and so I can using it to create a new site collection by using another PowerShell command "New-SPOSite"?

In addition, if I have created a new site collection from SharePoint Online and uploaded the site template on the new site collection's solution. Can I apply the site template to the new site collection using PowerShell? (I know how to apply it on SharePoint Online but I just want to apply it using PowerShell because applying the template using SharePoint Online always stuck on screen "Working on it... This shouldn't take long." and so I wanted to try to apply it using PowerShell.

Thank you very much.

1

1 Answers

0
votes

You might want to look into downloading the PnP Powershell modules. They are really quite useful and will help you to achieve what you are after.

You'll need to install them, which can be done from the following link: https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets

You can then create a template of your site easily by using the command:

Connect-PnPOnline -Url "https://<yourtenant>.sharepoint.com/sites/teamsite"
Get-PnPProvisioningTemplate -Out "c:\foldername\mynewtemplate.pnp"

You can then apply the template to other team sites by doing the following:

Connect-PnPOnline -Url "https://<yourtenant>.sharepoint.com/sites/teamsite"
Apply-PnPProvisioningTemplate -Path "c:\foldername\mynewtemplate.pnp"