Thursday, 10 April 2014

Moving SharePoint Site Collection

The following power shell script can be used to move a site collection from one location to another. It basically takes a backup and restores it in another location. I have used this in the past to archive sites to a /archive managed path.

$originalURL = Read-Host "Location of the original site collection:"
$newURL = Read-Host "Location to move the site collection to:"

$backupLocation = Read-Host "Location of the backup file:"

Backup-SPSite $originalURL -Path $backupLocation -force

#You may like to confirm the integrity of the backup before running this step...
Remove-SPSite -Identity $originalURL -Confirm:$false

Restore-SPSite -Identity $newURL -Path $backupLocation -force -Confirm:$false

Remove-Item $backupLocation 

No comments:

Post a Comment