Change the exisiting sharepoint site template to Modern/Communication site using Powershell cmdlet

In this blog. I have explained how to switch the existing classic site to modern sharepoint site and backup the existing site to archival site using Invoke-SPOSiteSwap

It requires sharepoint admin powershell version 16.0.8812.1200 or later.

Applicable for sharepoint online


Invoke-SPOSiteSwap -SourceUrl  <SiteUrl Parameter>
                    -TargetUrl  <SiteUrl Parameter>
                    -ArchiveUrl <SiteUrl Parameter>

Before run the site swap command connect to your sharepoint tenant using the below command

Connect-SPOService  -Url <adminUrl> 
Connect-SPOService -Url  "" 

Provide the username and password for your tenant to connect.

My root site collection is a classic site template. But i want existing communication site to be replaced as a root site collection.

Root Site Collection Classic Template #STS0

I have a communication site with me its already developed

Communication Site Template

Now run the powershell cmdlet to swap the existing communication site with classic template

SourceUrl: The site template what ever you want like Modern/Classic/Communication/Search to replaced with target site collection

TargetUrl: The site you want to replace the template

ArchiveUrl: It moves the existing site collection to archival

Note: ArchiveUrl does not contain the already existing sharepoint site collection and site collection from the recycle bin. You need to provide the unique site collection for ArchiveUrl. It create the site collection URL provided and move the content into it from the target site collection.


Hit the Archived Site URL. It has been replaced

Author Profile

Vinodh is a Microsoft MVP for SharePoint (Office Apps and Services) having 5+ years of experience in Microsoft Technologies.

His interest and expertise includes SharePoint Online Development, PowerApps Development, Flows for SharePoint and PowerApps. Single Page Apps/Add ins for SharePoint using React, Angular. SharePoint Farm Management, 2, 3 and upto 6 tier SharePoint Farm Installation and Configuration.

Awards :
Microsoft Most Valuable Professional for SharePoint and Office 365 awarded for the year 2016, 2017 and 2018.
C# Corner Most Valuable Professional for SharePoint and Office 365 awarded for the year 2016, 2017 and 2018.
Technology Expertise :
SharePoint Online, SharePoint 2013, SharePoint 2016 and SharePoint 2019 Preview.
Intranets both Modern and Classic, SharePoint Frameworks Customisation, SharePoint Add-ins, SharePoint single page apps.
Angular 5 with Bootstrap single page apps.
Typescript, JQuery and Javascript.
Micrsoft Flow and Powerapps.
Utilised :
Microsoft Graph API, SharePoint REST, SharePoint PnP JS.
Out of Box :
Consume Content search web parts for internet publishing sites using custom display templates.
Having knowledge on SharePoint workflows and SharePoint Designer workflows.
List customisation using JS Link, JSON Formatting.
Having knowledge in Active directory management services.
Create and configure service applications in SharePoint (MMS, UPSA, SSA).
Configure Outgoing email settings using SMTP Services.

Add a Comment

Your email address will not be published. Required fields are marked *