Skip to main content
Copy options in PowerShell
Updated over a month ago

There are different copy options you can apply in your PowerShell script.

Index

Content-only migration options

Applies to the following commands:

Configuration and filter options

For your configuration (custom permissions, preserve authors and timestamps, etc.) and Filter options (time range and file extensions), you have to define a property template or use an existing one.

Structure and content migration options

Applies to the Copy-Site or Copy-List commands.

Configuration

By default, when migrating with the Copy-Site or Copy-List commands, the application tries to replicate your source. To modify the configuration (permissions, workflows, etc.), you have to exclude the elements you do not want to preserve on your copy line with a switch parameter:

  • -NoCustomPermissions

  • -NoContent

  • -NoSiteFeatures

  • -NoCustomizedListForms

  • -NoListViews

  • -NoWorkflows

  • -NoNintexWorkflowHistory

  • -NoWebParts

  • -NoNavigation (Copy-Site only)

Example

Migrating a site with no custom permissions, no content, and no workflows:

$srcSite = Connect-Site -Url http://myfarm1/sites/mysourcesite
$dstSite = Connect-Site -Url http://myfarm1/sites/mydestinationsite
Copy-Site -Site $srcSite -DestinationSite $dstSite -Merge -NoCustomPermissions -NoContent -NoWorkflows

Note: There are two exceptions to this. You must add -UserAlerts and -Subsites if you want to keep user alerts and subsites.

To limit the number of versions, you can add -VersionLimit followed by the number of versions you want to keep.

To force lists to use the modern experience, you can add -ForceNewListExperience.

Dependencies

PowerShell does not allow changes to Dependencies.

  • If the hierarchy of sites in the source matches the destination, Mirror is used.

  • If the hierarchy does not match, the app copies the dependencies to the site at the destination.

Operation mode

For the Operation Mode (copy and replace, copy if newer, etc.), with all the copy commands, you have to define new copy settings.

Tip: Learn how to adapt your migration scripts to perform an incremental migration in the Incremental update using PowerShell article.

Insane mode and Normal mode

Your script will use Insane mode by default. You can overwrite the setting by adding -NormalMode to your copy line.

Did this answer your question?