Export/Import Sub-Site with PowerShell
January 5, 2012 Leave a Comment
Thanks to Russ Ramirez’s SharePoint Blog for providing me with the answer I needed. From his post, SPWeb move or clone in PowerShell, I was able to come up with the following script.
$moveFrom = https://WEBAPP1/sites/SITECOLLECTION/SITEA/SITEA1 $moveTo = https://WEBAPP2/sites/SITECOLLECTION/SITEB/SITEB1/SITEA1NEW $backup = "E:\Backup\20120104_BACKUP.cmp" $siteName = "SITE NAME" $siteDesc = "SITE DESCRIPTION" Get-SPWeb $moveFrom | Select-Object -Property WebTemplate, Configuration # !! Based on the results of the Get-SPWeb, update the next line for Template (Concat WebTemplate + "#" + Configuration) New-SPWeb -Url $moveTo -Template STS#0 -Name $siteName -Description $siteDesc Export-SPWeb $moveFrom -Path $backup -IncludeVersions All -Verbose -CompressionSize 100000000 Import-SPWeb $moveTo -Path $backup -Force
Advertisement
