When you have to move or clone a web in SharePoint 2010, you can make use of the Export-SPWeb and Import-SPWeb cmdlets in the Management Shell. The semantic difference between a move and a clone is whether you delete the web you exported from. There are just 4 basic steps.
1) Determine template used to create the source web
Get-SPWeb <web root url> | Select-Object -Property WebTemplate, Configuration
Where: <web root url> is http://myportal/sub-web1/sub-web11 for example
The output will look like this:
WebTemplate Configuration
——————– ——————–
BLANKINTERNET 2
2) Create a new blank web at a new location using the template determined from 1)
New-SPWeb -Url <web root url> -Template <template name string> -Name <title of web> -Description <description text>
Example: New-SPWeb -Url http://myportal/sub-web2/sub-web21 -Template BLANKINTERNET#2 -Name “subweb21″ -Description “New blank publishing site with workflow”
3) Export existing web
Export-SPWeb <web root url> -Path C:\ExportImportData\<web name>WebExport.cmp -CompressionSize 100000000
Example: Export-SPWeb http://myportal/sub-web1/sub-web11 -Path C:\ExportImportData\WebExport.cmp -CompressionSize 100000000
4) Import the web just exported in 3) into new web created in 2)
Import-SPWeb <web root url> -Path C:\ExportImportData\WebExport.cmp -Force
Example: Import-SPWeb http://myportal/sub-web2/sub-web21 -Path C:\ExportImportData\WebExport.cmp -Force
Advertisement
Thank you! That was exactly what I needed.
Pingback: Export/Import Sub-Site with PowerShell « SharePoint Diva