Export-SPWeb
Applies to: SharePoint Server 2010, SharePoint Foundation 2010
Topic Last Modified: 2013-04-16
Exports a site, list, or library.
Export-SPWeb [-Identity] <SPWebPipeBind> -Path <String> [-AssignmentCollection <SPAssignmentCollection>] [-CompressionSize <Int32>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-HaltOnError <SwitchParameter>] [-HaltOnWarning <SwitchParameter>] [-IncludeUserSecurity <SwitchParameter>] [-IncludeVersions <LastMajor | CurrentVersion | LastMajorAndMinor | All>] [-ItemUrl <String>] [-NoFileCompression <SwitchParameter>] [-NoLogFile <SwitchParameter>] [-UseSqlSnapshot <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
The Export-SPWeb cmdlet exports a site, list, or library. The capability to export from a library is a new feature in SharePoint 2010 Products.
| Parameter | Required | Type | Description | ||
|---|---|---|---|---|---|
| Identity | Required | Microsoft.SharePoint.PowerShell.SPWebPipeBind | Specifies the URL or GUID of the Web to be exported. The type must be a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; a valid name of a SharePoint site (for example, MySPSite1); or an instance of a valid SPWeb object. | ||
| Path | Required | System.String | Specifies the name of the export file. If the NoFileCompression parameter is used, a directory must be specified; otherwise, any file format is valid. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
| ||
| CompressionSize | Optional | System.Int32 | Sets the maximum file size for the compressed export files. If the total size of the exported package is greater than this size, the exported package will be split into multiple files. | ||
| Confirm | Optional | System.Management.Automation.SwitchParameter | Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters | ||
| Force | Optional | System.Management.Automation.SwitchParameter | Forcefully overwrites the export package if it already exists. The type must be either of the following values: -True -False The default value is False. | ||
| HaltOnError | Optional | System.Management.Automation.SwitchParameter | Stops the export process when an error occurs. | ||
| HaltOnWarning | Optional | System.Management.Automation.SwitchParameter | Stops the export process when a warning occurs. | ||
| IncludeUserSecurity | Optional | System.Management.Automation.SwitchParameter | Preserves the user security settings except for SPLists that have broken inheritance and item level permissions set. | ||
| IncludeVersions | Optional | Microsoft.SharePoint.Deployment.SPIncludeVersions | Indicates the type of file and list item version history to be included in the export operation. If the IncludeVersions parameter is absent, the Export-SPWeb cmdlet by default uses a value of 1. The type must be any one of the following versions: -Last major version for files and list items (default) -The current version, either the last major version or the last minor version -Last major and last minor version for files and list items -All versions for files and list items | ||
| ItemUrl | Optional | System.string | Specifies the URL of the Web application, GUID, or object to be exported. The type must be a valid URL; for example, http://server_name. | ||
| NoFileCompression | Optional | System.Management.Automation.SwitchParameter | Either enables or disables file compression in the export package. The export package is stored in the folder specified by the Path parameter or Identity parameter. We recommend that you use this parameter for performance reasons. If compression is enabled, the export process can increase by approximately 30 percent. | ||
| NoLogFile | Optional | System.Management.Automation.SwitchParameter | Suppresses the generation of an export log file. If this parameter is not specified, the Export-SPWeb cmdlet will generate an export log file in the same location as the export package. The log file uses Unified Logging Service (ULS). It is recommended to use this parameter. However, for performance reasons, you might not want to generate a log file. | ||
| UseSqlSnapshot | Optional | System.Management.Automation.SwitchParameter | Specifies a SQL Database Snapshot will be created when the export process begins, and all exported data will be retrieved directly from the database snapshot. This snapshot will be automatically deleted when export completes. | ||
| WhatIf | Optional | System.Management.Automation.SwitchParameter | Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters |
--------------------EXAMPLE-----------------------.
Export-SPWeb http://site -Path "site export.cmp"
This example exports the site at http://site/ to a file called site export.cmp in the current directory.

Note