The export / import operations seems to be working quite well except for lookup columns. The lookup columns and other columns associated with the lookup are all empty.
Is this a limitation? Is there any script or tool that can overcome this?
Here's my code:
#This is the source web that is hosting the lists to move
$sourceWebUrl = "http://servername/subsite"
#This is the destination web, where the lists will be copied to
$destWebUrl = "http://servername/sites/subsite"
#Location to store the export file
$path = "\\servername\Backups\"
#comma delimited list of List Names to copy
$lists = @("list2", "list1")
#Loop through the lists, export the list from the source, and import the list into the destination
foreach($list in $lists)
{
"Exporting " + $sourceWebUrl + "/lists/" + $list
export-spweb $sourceWebUrl -ItemUrl ("lists/" + $list) -IncludeUserSecurity -IncludeVersions All -path ($path + $list + ".cmp") -nologfile
"Exporting complete."
"Importing " + $destWebUrl + "/lists/" + $list
import-spweb $destWebUrl -IncludeUserSecurity -path ($path + $list + ".cmp") -nologfile
"Importing Complete"
"`r`n`r`n"
}
Source taken from http://blogs.msdn.com/b/jorman/archive/2011/01/08/copying-lists-with-powershell-in-sharepoint-2010.aspx