Change The Existing Sharepoint Site Template To Modern/Communication Site Using Powershell Cmdletnge

Introduction 

 
In this article. 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.
 
This tutorial is applicable to Sharepoint online.
 
Command
  1. Invoke-SPOSiteSwap -SourceUrl  <SiteUrl Parameter>  
  2.                     -TargetUrl  <SiteUrl Parameter>  
  3.                     -ArchiveUrl <SiteUrl Parameter>  
Before run the above site swap command, connect to your sharepoint tenant using the below command:
  1. Connect-SPOService  -Url <adminUrl>   
  1. Connect-SPOService -Url  "https://sharepointtechie-admin.sharepoint.com"   
Provide the username and password for your tenant to connect.
 
My root site collection is a classic site template. But I want the existing communication site to be replaced as a root site collection.
 
Change The Existing Sharepoint Site Template To Modern/communication Site Using Powershell Cmdletnge The Existing Sharepoint Site Template To Modern/Communication
 
Root Site Collection Classic Template #STS0
 
I have a communication site that's already created.
 
Change The Existing Sharepoint Site Template To Modern/communication Site Using Powershell Cmdletnge The Existing Sharepoint Site Template To Modern/Communication
 
Communication Site Template
 
Now run the PowerShell cmdlet to swap the existing communication site with a classic template.
 
Change The Existing Sharepoint Site Template To Modern/communication Site Using Powershell Cmdletnge The Existing Sharepoint Site Template To Modern/Communication
 
Change The Existing Sharepoint Site Template To Modern/communication Site Using Powershell Cmdletnge The Existing Sharepoint Site Template To Modern/Communication
 
SourceURL
 
The site template can be whatever you want, whether it be Modern/Classic/Communication/Search, it can be replaced with the 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 a unique site collection for ArchiveUrl.
 
It creates the site collection URL provided and moves content into it from the target site collection.
 
Finally...
 
Change The Existing Sharepoint Site Template To Modern/communication Site Using Powershell Cmdletnge The Existing Sharepoint Site Template To Modern/Communication
 
Hit the Archived Site URL. It has been replaced successfully.
 
Change The Existing Sharepoint Site Template To Modern/communication Site Using Powershell Cmdletnge The Existing Sharepoint Site Template To Modern/Communication
 
Happy Coding