Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
in SharePoint Server by 25 39 47

Is there anyway to change the SharePoint site template after creating the SharePoint site using PowerShell?

I tried to use the below shell, but it's not worked!

Set-SPSite http://sp2019 -Template "STS#0"

I encountered the below error

Set-SPSite http://sp2019 -Teplate "STS#0"
set-SPSite : A site template has already been applied to this
site. Once a template has been applied, the site must be deleted
and recreated in order to apply a different template.
At line:1 char:1
+ set-SPSite http://sp2019 -Template "STS#0"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...SPCm
   dletSetSite:SPCmdletSetSite) [Set-SPSite], SPException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCm

1 Answer

1 like 0 dislike
by 82 149 313
selected by
Best answer

Change SharePoint Site Template PowerShell

As a Short answer: NO, it's not possible!

  • If you already have a SharePoint site with a Template applied, you can't change its template to another template.
  • There is no workaround to update the SharePoint site template in all SharePoint versions.
  • The only option to change the SharePoint site template is to recreate a new SharePoint site with your preferred SharePoint Template

Create SharePoint Site using PowerShell

To create a SharePoint site with a specific template using PowerShell, you should do the following:

  • Open SharePoint Shell as Administrator.
  • Run "New-SPSite" cmdlet with your own value as shown below

      New-SPSite  -URL "Site Collection URL" -ContentDatabase "Content Database Name" -Template sts#0 -OwnerAlias "domain\account"

You might also like to read

If you don’t ask, the answer is always NO!