Requirement: Clone the Production SharePoint site collection to Test environment for UAT.
Copy a Site Collection in SharePoint using PowerShell:
While Copy-SPSite cmdlet on SharePoint 2013 or later serves the purpose, It can clone site collection only within the same web application. What if you want to copy a site collection to another web application or another farm in SharePoint? Well, follow these steps to copy site collection to same/another farm.
- Create a new Web application
- Backup the live site collection
- Restore the backup into the target web application
Backup the Source Site Collection:
Backup-SPSite -Identity "http://portal.crescent.com" -Path "D:\backup\portal.bak" -Force -NoSiteLock -Confirm:$False
Restore the backup into Target Site collection:
Restore-SPSite "http://testportal.crescent.com" -Path "D:\backup\portal.bak" -Force -Confirm:$False
You can use this method to copy a site collection to another server or another server or another web application in SharePoint. Remember to do the following:
- Install & Deploy any Farm level feature to the newly created Web Application from Central Admin.
- Configure Web App settings, such as: Web Application policy, Outgoing Email settings, etc.