Command
Copy-Site
Description
The command to copy sites from a SharePoint site to another.
Note: ShareGate Migrate is unable to provision a site collection with PowerShell. If you run Copy-Site with your central admin, admin center or root site collection URL at the destination, you risk damaging the root site collection at that location.
Tips:
You will find how to adapt any Copy-Site script to perform an incremental migration in the Incremental update using PowerShell article.
To learn how to replicate your copy options from ShareGate Migrate in PowerShell click here.
Index
Examples
Merge Site with Destination Site
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" $dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" Copy-Site -Site $srcSite -DestinationSite $dstSite -Merge -Subsites
Copy Site As Subsite
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" $dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" Copy-Site -Site $srcSite -DestinationSite $dstSite
Get Subsites to Copy
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" $dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" $toCopy = Get-Subsite -Site $srcSite Copy-Site -Site $toCopy -DestinationSite $dstSite
Copy All Subsites
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" $dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" Copy-Site -All -SourceSite $srcSite -DestinationSite $dstSite
Copy Site As Subsite PreCheck
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" $dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" Copy-Site -Site $srcSite -DestinationSite $dstSite -WhatIf
Copy Some Subsites
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" $srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" Copy-Site -Name MyName*,MySpecificName -SourceSite $srcSite -DestinationSite $dstSite
Note: The * symbol is used to call multiple objects with a similar name.
Copy and Rename One Subsite
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite" $srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite" Copy-Site -Name MyName*,MySpecificName -SourceSite $srcSite -DestinationSite $dstSite -SiteTitle "MyNewName" -SiteTitleUrlSegment "MyNewUrl"
Note: The * symbol is used to call multiple objects with a similar name.
Syntax
These are sets of compatible parameters for the Copy-Site command.
Copy-Site-Site <Site[]>-DestinationSite <Site> [-Merge <SwitchParameter>] [-NoNavigation <SwitchParameter>] [-Subsites <SwitchParameter>] [-SiteTitle <String>] [-SiteTitleUrlSegment <String>] [-NoContent <SwitchParameter>] [-VersionLimit <Int32>] [-NoCustomPermissions <SwitchParameter>] [-NoWorkflows <SwitchParameter>] [-NoSiteFeatures <SwitchParameter>] [-NoWebParts <SwitchParameter>] [-NoCustomizedListForms <SwitchParameter>][-NoListViews <SwitchParameter>] [-NoNintexWorkflowHistory <SwitchParameter>] [-UserAlerts <SwitchParameter>] [-NormalMode <SwitchParameter>] [-WaitForImportCompletion <SwitchParameter>] [-ForceNewListExperience <SwitchParameter>] [-WhatIf <SwitchParameter>] [-CopySettings <CopySettings>] [-MappingSettings <MappingSettings>] [-TaskName <String>]
Copy-Site-Name <String[]>-SourceSite <Site> -DestinationSite <Site>[-Merge <SwitchParameter>] [-NoNavigation <SwitchParameter>][-Subsites <SwitchParameter>] [-SiteTitle <String>][-SiteTitleUrlSegment <String>] [-NoContent <SwitchParameter>][-VersionLimit <Int32>] [-NoCustomPermissions <SwitchParameter>][-NoWorkflows <SwitchParameter>] [-NoSiteFeatures <SwitchParameter>][-NoWebParts <SwitchParameter>] [-NoCustomizedListForms <SwitchParameter>][-NoListViews <SwitchParameter>][-NoNintexWorkflowHistory <SwitchParameter>] [-UserAlerts <SwitchParameter>][-NormalMode <SwitchParameter>][-WaitForImportCompletion <SwitchParameter>] [-ForceNewListExperience <SwitchParameter>][-WhatIf <SwitchParameter>] [-CopySettings <CopySettings>][-MappingSettings <MappingSettings>] [-TaskName <String>]
Copy-Site-All <SwitchParameter> -SourceSite <Site> -DestinationSite <Site> [-Merge <SwitchParameter>] [-NoNavigation <SwitchParameter>] [-Subsites <SwitchParameter>] [-SiteTitle <String>] [-SiteTitleUrlSegment <String>] [-NoContent <SwitchParameter>] [-VersionLimit <Int32>] [-NoCustomPermissions <SwitchParameter>] [-NoWorkflows <SwitchParameter>] [-NoSiteFeatures <SwitchParameter>] [-NoWebParts <SwitchParameter>] [-NoCustomizedListForms <SwitchParameter>][-NoListViews <SwitchParameter>] [-NoNintexWorkflowHistory <SwitchParameter>] [-UserAlerts <SwitchParameter>] [-NormalMode <SwitchParameter>] [-WaitForImportCompletion <SwitchParameter>] [-ForceNewListExperience <SwitchParameter>] [-WhatIf <SwitchParameter>] [-CopySettings <CopySettings>] [-MappingSettings <MappingSettings>] [-TaskName <String>]
Parameters
-All <SwitchParameter>
Specifies that all the subsites are copied. Copies only the subsites, without the parent site.
Required? | True |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | All |
Aliases | None |
-CopySettings <CopySettings>
Specifies the copy settings.
Required? | False |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-DestinationSite <Site>
Specifies the destination site.
Required? | True |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-ForceNewListExperience <SwitchParameter>
Specifies that your lists and libraries will be converted to the new Microsoft 365 list experience when possible.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-MappingSettings <MappingSettings>
Specifies the mapping settings.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-Merge <SwitchParameter>
Specifies the source site is merged with the destination site instead of adding it as a subsite. This parameter can not be used when copying more than one site.
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 a subsite (Wildcards supported).
Required? | True |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | True |
Parameter set name | Name |
Aliases | None |
-NoContent <SwitchParameter>
Specifies that all list items, documents, folders and document sets inside the lists and libraries are not copied (only the structure is copied).
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoCustomizedListForms <SwitchParameter>
Specifies that customized list forms and content type forms won't be copied.
Required? | False |
Default value | None |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoCustomPermissions <SwitchParameter>
Specifies that not custom permissions are copied. Permissions are inherited from the parent.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoListViews <SwitchParameter>
Specifies that list views won't be copied.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoNavigation <SwitchParameter>
Specifies that the site navigation and quick launch settings are not preserved during the copy. The settings are set to default in the destination site.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoNintexWorkflowHistory <SwitchParameter>
Specifies that the history for Nintex workflows are not copied to the destination.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NormalMode <SwitchParameter>
Specifies that Normal mode is used.
Note: Insane mode is always used by default in PowerShell.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoSiteFeatures <SwitchParameter>
Specifies that all the site and site collection features that are required are not automatically activated.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoWebParts <SwitchParameter>
Specifies that the web parts are not copied.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-NoWorkflows <SwitchParameter>
Specifies that the workflows are not copied to the destination.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-Site <Site[]>
Specifies the source site.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | Default |
Aliases | None |
-SiteTitle <String>
Specifies the new site title. This parameter must be used with the SiteTitleUrlSegment parameter and can not be used when copying more than one site.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-SiteTitleUrlSegment <String>
Specifies the new site url that is relative to its parent site. This parameter must be used with the 'SiteTitle' parameter and can not be used when copying more than one site.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-SourceSite <Site>
Specifies the source site.
Required? | True |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | Name, All |
Aliases | None |
-Subsites <SwitchParameter>
Specifies that all subsites from source site will be copied.
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 |
-UserAlerts <SwitchParameter>
Specifies that the User Alerts are copied to the destination.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-VersionLimit <Int32>
Specifies the number of versions preserved, 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 |
-WaitForImportCompletion <SwitchParameter>
Specifies that ShareGate Migrate will wait for the Microsoft 365 import from Azure to be completed.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-WhatIf <SwitchParameter>
Specifies that a pre-check is executed instead of a migration. For more information, see Run a Pre-Check in PowerShell.
Required? | False |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |