I'm trying to do an "export-spweb" command in Powershell to mass-transfer lists and libraries from one site to another. Now, it partially worked, in that all my Lists that were not Doc Libraries successfully exported to .cmp files. For some reason, though, when I try the same script on Doc Libraries, it fails with the error:

Export-SPWeb : The URL provided is invalid. Only valid URLs that are site colle ctions or sites are allowed to be exported using stsadm.exe. At line:1 char:13

Here's the script that works fine:

export-spweb http://myspsite/subsite1 -ItemUrl "lists/List Name Here" -path C:\testexport.cmp

And here is the script that gives the above error message

export-spweb http://myspsite/subsite1 -ItemUrl "lists/Document Library Name Here" -path C:\testexport.cmp

Am I doing something wrong here, or is there a difference with exporting Lists vs Libraries?

3 Answers 3


Yes, document libraries don't live in "lists/", it's just the "document library name here"

  • You're my hero.
    – Alex
    Sep 16, 2013 at 21:09

Technet article is confusing when it comes to the library and lists.

For Document library at subsite use : Export-SPWeb -Identity http://TopLevelSite/sites/Subsite -ItemUrl DocLibName -Path "E:\Temp\Export.cmp" -Force -Verbose

For Lists use: Export-SPWeb -Identity http://TopLevelSite/sites/Subsite -ItemUrl Lists/ListName -Path "E:\Temp\Export.cmp" -Force -Verbose

Note: There is no "/" when exporting library before the library name.


Why can open your document library in Explorer end use copy-paste. I moved library from one portale to enother use that way.

  • Well, yes, UNLESS you want to do that for 50, or 100, or 1000 libraries...then well, be my guest. Also, that only works for libraries, not lists.
    – Alex
    Sep 17, 2013 at 18:36
  • 1
    Try SharePoint Content Deployment Wazard it's free and open source. Sep 18, 2013 at 5:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.