Skip to main content
Export Site
Updated this week

Command

Export-Site

Description

The command to export sites from a SharePoint site to a file share. This command is the equivalent of using Download on a site in Explorer.

Index

Examples

Export Site

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
Export-Site -Site $srcSite -DestinationFolder "G:\MyDestinationFolder\Subfolder" -Subsites

Get Subsites to Export

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$toCopy = Get-Subsite -Site $srcSite
Export-Site -Site $toCopy -DestinationFolder "G:\MyDestinationFolder\Subfolder"

Export All Subsites

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
Export-Site -All -SourceSite $srcSite -DestinationFolder "G:\MyDestinationFolder\Subfolder -Subsites"

Export Some Subsites

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
Export-Site -Name MyName*,MySpecificName -SourceSite $srcSite -DestinationFolder "G:\MyDestinationFolder\Subfolder"

Note: The * symbol is used to call multiple objects with a similar name.

Export With Options

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
Export-Site -Site $srcSite -DestinationFolder "G:\MyDestinationFolder\Subfolder" -VersionLimit 2 -FlattenFolders

Syntax

Export-Site-Site <Site[]>-DestinationFolder <Uri>[-Subsites <SwitchParameter>][-NoVersionHistory <SwitchParameter>][-VersionLimit <Int32>][-FlattenFolders <SwitchParameter>][-TaskName <String>]
Export-Site-All <SwitchParameter>-SourceSite <Site>-DestinationFolder <Uri>[-Subsites <SwitchParameter>][-NoVersionHistory <SwitchParameter>][-VersionLimit <Int32>][-FlattenFolders <SwitchParameter>][-TaskName <String>]
Export-Site-Name <String[]>-SourceSite <Site>-DestinationFolder <Uri>[-Subsites <SwitchParameter>][-NoVersionHistory <SwitchParameter>][-VersionLimit <Int32>][-FlattenFolders <SwitchParameter>][-TaskName <String>]

Parameters

-All <SwitchParameter>

Specifies that all direct subsites of the specified source site will be exported.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

All

Aliases

None

-DestinationFolder <Uri>

Specifies the destination folder path. Note: This parameter cannot be used to create new folders at the destination.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-FlattenFolders <SwitchParameter>

Specifies that folder hierarchy will be flattened when exporting.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Name <String[]>

Specifies the name of the source site's subsite(s) to export (wildcards supported).

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

True

Parameter set name

Name

Aliases

None

-NoVersionHistory <SwitchParameter>

Specifies that the version history won't be preserved.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Site <Site[]>

Specifies the site(s) to export.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

Default

Aliases

None

-SourceSite <Site>

Specifies the parent site.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

All, Name

Aliases

None

-Subsites <SwitchParameter>

Specifies that all subsites of the specified site(s) must be exported.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-TaskName <String>

Specifies a name for the task.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-VersionLimit <Int32>

Specifies the export of the X latest version, while always conserving at least one major version.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?