SharePoint Online: How to Create a Site Design from Existing Site using PowerShell?

How to Create a New Site Collection from an existing site in SharePoint Online?

With the Get-SPOSiteScriptFromWeb cmdlet, we can create a site design from an existing site collection and then use the site design to create new instances of the site. The cmdlet is a new feature addition to SharePoint Online! It extracts the site schema from a given site and can be used to create copies of any existing site structure. Here are the basic syntax and examples:

Syntax:
Get-SPOSiteScriptFromWeb -WebUrl $siteUrl -IncludeTheming -IncludeBranding -IncludeSiteExternalSharingCapability -IncludeRegionalSettings -IncludeLists $RelativeListUrls

Example:
Get-SPOSiteScriptFromWeb -WebURL https://crescent.sharepoint.com/sites/marketing  -IncludeBranding -IncludeTheme -IncludeRegionalSettings -IncludeSiteExternalSharingCapability -IncludedLists (“Lists/work”,”Marketing%20Documents”)

Create Site Design from an Existing site using PowerShell

Before using this cmdlet, make sure you have the updated SharePoint Online PowerShell module installed: How to Update SharePoint Online PowerShell Module?

#Define Parameters
$AdminCenterURL = "https://crescent-admin.sharepoint.com"
$SiteURL = "https://crescent.sharepoint.com"
 
#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -credential (Get-Credential)
 
#Get the site schema
$SiteSchema = Get-SPOSiteScriptFromWeb -WebURL $SiteURL -IncludeBranding -IncludeTheme -IncludeRegionalSettings -IncludeSiteExternalSharingCapability -IncludedLists ("Lists/Events","Shared%20Documents")
 
#Add site schema as Site Script 
$SiteScript = Add-SPOSiteScript -Title "Crescent Site Template v1" -Content $SiteSchema
 
#Create a Site Design for Team Site template
$SiteDesign = Add-SPOSiteDesign -Title "Crescent Site Template v1" -WebTemplate 64 -SiteScripts $SiteScript.Id

Once the site template is created, You can create a new site collection based on the site design you had created: Or apply the site design on existing sites.

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

5 thoughts on “SharePoint Online: How to Create a Site Design from Existing Site using PowerShell?

  • I am getting a file not found error

    Reply
  • I am not able to see the site design dropdown in my case . The script ran successfully. But I am not able to find it on SP Admin center or on Subsite creation.

    Reply
    • Now, It’s moved under “Apply a Site Template” >> “From your organization” section of site collections.

      Reply
  • Hello, this is fantastic. Can this work for a subsite?

    Reply
  • Thanks for the update

    Reply

Leave a Reply