First published on TECHNET on Mar 09, 2017
The Copy-SPSite command was introduced in SharePoint 2013. The TechNet description states that the command “Makes a copy of a site collection.”
Administrators should carefully understand when to use Copy-SPSite and what impact the usage might have.
In the past years, I have seen SharePoint customers using Copy-SPSite for various occasions:
- Duplicating Sites from a template, to provision Site Collections
- Using Copy-SPSite to rename Site Collections in SharePoint 2013
(Todd's Blog Post )
I have been supporting multiple customers suffering from issues caused by the (improper) use of the Copy-SPSite command. The intention of this blog post is to create awareness of known issues after using the CopySPSite command and for Administrators to carefully use it.
Potential problems after using Copy-SPSite
Examples of issues that have been reported by customers to Microsoft Support:
- OneDrive Sync Client might fail syncing content from sites that have been duplicated using Copy-SPSite.
- There is an issue with deleted items in Recycling Bins within duplicated sites created using Copy-SPSite.
- Third Party Backup/Restore Tools as well as Microsoft DPM is failing restoring content from duplicated sites.
- Third Party Migration Tools might fail migrating content from farms, that have duplicated sites created using Copy-SPSite.
- Exporting content using Export-SPWeb is going to fail if sites that have been duplicated using Copy-SPSite are within the same content database:
"These columns don't currently have unique values."
This is a common indicator, that you are affected by problems resulting from Copy-SPSite.
Check the following image, that shows how the Copy-SPSite command impacts Export-SPWeb Operation:
Copy-SPSite is causing duplicated GUIDs within the site(s) that have been created by the command. The Site Collection ID is going to be unique, Web and List GUIDs won't. This is most likely causing the issues mentioned above.
Consider one of the following options as a possible workaround. Carefully read and understand the impact, test in a production clone to verify the solution. Contact Microsoft Premier Support or a Microsoft Partner if you need additional guidance or advisory.
Proper Copy-SPSite usage
Delete the source site after using Copy-SPSite
Copy site to a different content database
Use the Copy-SPSite -DestinationDatabase parameter to copy the site to another content database within the web application. This Workaround should be considered as short term only. This still might cause you problems in the future, as duplicate GUIDs remain within the farm.
Export/Import affected sites to generate new GUIDs
1. Move affected duplicated sites in a seperate content database within the web application using Move-SPSite
2. Export the moved site using Export-SPWeb
3. Import it into a new site using Import-SPWeb . This is going to eleminate duplicate GUIDs by generating new ones.
4. Delete the source site that was moved to the seperate content database (see 1.)
Update (April 20th, 2017)
Good News! The December 2016 CU for SharePoint 2013 fixes the issue that occurs while using the Export-SPWeb operation on sites that have been created using the Copy-SPSite operation.
See: December 13, 2016, update for SharePoint Foundation 2013 (KB3128007). Thank you Torsten for sharing this information!
Please be aware, that you should carefully consider using Copy-SPSite. This command should only be used for special operations. Avoid using Copy-SPSite as a Site Provisioning technique, as this would cause your farm being victim of problems that might not be visible right away, but cause problems in the future. There are known issues/bugs, therefor try to avoid using the command in daily operation. Regarding the known issues, you should only use Copy-SPSite in circumstances where long term GUID duplication can be avoided by deleting source sites after using the command.
I hope this article helps you prevent having problems during SharePoint operation. Please share your experiences in the comments. Any feedback or additions for this post is highly welcome.
Thank you for rating this article if you liked it or it was helpful for you.