Skip to main content
Copy options in PowerShell
Updated this week

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

Index

Content-only migration options

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

When migrating with the Copy-Site or Copy-List commands, the application will try to replicate your source by default. To modify the configuration (permissions, workflows, etc.), you have to dismiss the elements you do not wish to preserve on your copy line with a switch parameter:

  • -NoCustomPermissions

  • -NoContent

  • -NoSiteFeatures

  • -NoCustomizedListForms

  • -NoListViews

  • -NoWorkflows

  • -NoNintexWorkflowHistory

  • -NoWebParts

  • -NoNavigation

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 wish to keep user alerts and subsites.

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

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

Dependencies

It is not possible to change Dependencies with PowerShell.

If the hierarchy of your sites matches between the source and the destination, Mirror is used.

If the hierarchy does not match, the app will copy 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: You will find 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?