can i use powershell to copy list from one server to another server

Jan 20, 2010 at 6:24 AM

Will  this work across servers e.g from
http://myserver1:9090/sites/mysite/list/mylist

to

http://myserver2:9090/sites/mysite/list/mylist

Thanks in Advance.
Looking for a script if possible(I haven;t found any other solutions)

 

 

Coordinator
Jan 20, 2010 at 9:07 AM

Hi,

Yes you can do that.

Two scripts are available for that kind of question :

 - http://sharepointpsscripts.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=21696

Have a good day.

Fabrice Romelard [[MVP]]

Jan 22, 2010 at 12:26 AM

Hi Fabrice,

            I did try using the nice handy scripts.
I did an export but since the list is huge it splitted it into ExportList-fb0cdceb-b72f-4e70-b577-41dec67784c2.DAT,ExportList-fb0cdceb-b72f-4e70-b577-41dec67784c20.DAT etc... they are like 12 of them

Now when i do an import i started wih the first .dat file

Import-List "http://myserver:8080/sites/centre/Lists/Store%20Com/" "ExportList-fb0cdceb-b72f-4e70-b577-41dec67784c2.DAT" "C:\SharepointPowerShellScripts\log\logImportLog.txt"

I get error :

[22/01/2010 11:15:46 AM]: Start Time: 22/01/2010 11:15:46 AM.
[22/01/2010 11:15:46 AM]: Progress: Initializing Import.
[22/01/2010 11:15:55 AM]: Error: Failure writing to target file
[22/01/2010 11:15:55 AM]: Debug:    at Microsoft.SharePoint.Library.SPRequest.ExtractFilesFromCabinet(String bstrTempDirectory, String bstrCabFileLocation)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.<>c__DisplayClass2.<Uncompress>b__0()
   at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)
   at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
   at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.Uncompress(SPRequest request)
[22/01/2010 11:15:55 AM]: FatalError: Failed to read package file.
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.Uncompress(SPRequest request)
   at Microsoft.SharePoint.Deployment.SPImport.Run()
*** Inner exception:
Failure writing to target file
   at Microsoft.SharePoint.Library.SPRequest.ExtractFilesFromCabinet(String bstrTempDirectory, String bstrCabFileLocation)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.<>c__DisplayClass2.<Uncompress>b__0()
   at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)
   at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
   at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.Uncompress(SPRequest request)
[22/01/2010 11:15:56 AM]: Progress: Import Completed.
[22/01/2010 11:15:56 AM]: Finish Time: 22/01/2010 11:15:56 AM.
[22/01/2010 11:15:56 AM]: Completed with 0 warnings.
[22/01/2010 11:15:56 AM]: Completed with 2 errors.

 

Any ideas?

Jan 22, 2010 at 7:01 AM

fabrice  i camr across this blog for a solution

http://microsoftepms.blogspot.com/2009/10/stsadm-export-and-import-error-when.html

 

but now i get error

[22/01/2010 5:23:03 PM]: FatalError: Exception from HRESULT: 0x81070518
   at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)
   at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents)
   at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents)
   at Microsoft.SharePoint.SPListItem.SystemUpdate()
   at Microsoft.SharePoint.Deployment.ListItemSerializer.UpdateAttachmentsData(SPListItem listItem, String attachmentXml, StreamingContext context, ISurrogateSelector selector)
   at Microsoft.SharePoint.Deployment.ListItemSerializer.SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector)
   at Microsoft.SharePoint.Deployment.XmlFormatter.ParseObject(Type objectType, Boolean isChildObject)
   at Microsoft.SharePoint.Deployment.XmlFormatter.DeserializeObject(Type objectType, Boolean isChildObject, DeploymentObject envelope)
   at Microsoft.SharePoint.Deployment.XmlFormatter.Deserialize(Stream serializationStream)
   at Microsoft.SharePoint.Deployment.ObjectSerializer.Deserialize(Stream serializationStream)
   at Microsoft.SharePoint.Deployment.ImportObjectManager.ProcessObject(XmlReader xmlReader)
   at Microsoft.SharePoint.Deployment.SPImport.DeserializeObjects()
   at Microsoft.SharePoint.Deployment.SPImport.Run()
[22/01/2010 5:23:05 PM]: Progress: Import Completed.
[22/01/2010 5:23:05 PM]: Finish Time: 22/01/2010 5:23:05 PM.
[22/01/2010 5:23:05 PM]: Completed with 2095 warnings.
[22/01/2010 5:23:05 PM]: Completed with 1 errors.

Any ideas would be appreciated

 

Coordinator
Jan 25, 2010 at 2:09 PM

Hi,

Are you sure you installed exatly the same solutions, features, list templates, site templates, ... on the 2 farms ?

It could be from site columns missing for example.

In other case, i don't know.

You can contact Microsoft Support and see to open a case about that.

Fabrice Romelard [MVP]

Jan 27, 2010 at 3:11 AM

Fabrice,
        Its not the same or duplicate.
The problem i have is that the script exports the parent web plus all th lists,docs etc..
I taught it exports only the list.
Is this possible to export only the content of the list?

Thks in Advance

Coordinator
Feb 1, 2010 at 9:43 AM

Hi,

You don't need any script for that, just use STSADM -O EXPORT

Look the help about this command and use it with your list.

Have a good day.

Fabrice Romelard [MVP]