We've previously described how to back up and restore site collections, but sometimes we just need to export the content from a site or subweb, and then we'll use these two commands.
Export-spweb Example
Export-spweb Http://web_name-Path web.cmp
Parameters
- Force: Overwrites the existing export file.
- Compressionsize: Sets the maximum size of the exported file, if it is exceeded, it will be split into multiple files.
- Includeversions: Sets the type of file and list item version history that is contained in the export file, or the current major version if not specified.
Import-spweb Example
Import-spweb Http://web_name-Path web.cmp
Parameters
- Force: Overwrites the existing site.
- Activatesolutions: Sets whether the user solution is activated when the site is imported.
- Updateversions: Sets the version of the file that is imported to the Web site that already exists on the site, and the default is to add a new version.
Enjoy SharePoint
SharePoint PowerShell Command Series (2) Export-spweb & Import-spweb