You can modify your script to perform a second migration that copies only the newer items from the source.
Details
Incremental updates in PowerShell are equivalent to using Copy if newer (incremental) in the copy settings of ShareGate Migrate.
The incremental update parameter copies only list items and documents in your lists and libraries that are newer than their counterparts in the destination.
Tip: We recommend reading the Copy if newer (incremental) article to understand how the feature works and the limitations before using the setting in your script.
How-to
To perform an incremental migration, first run a regular PowerShell migration, then rerun the operation with a modified script.
To modify your script to run an incremental copy:
Define your copy settings to use incremental copy in a new variable by adding the following line at the beginning of your script:
$copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate
Add -CopySettings $copysettings to your copy line:
Copy-Content -SourceList $srcList -DestinationList $dstList -CopySettings $copysettings
Note: You can use -CopySettings with the following commands: Copy-List, Copy-Site, Copy-Content, Import-Document, Import-GoogleDriveDocument, and Import-BoxDocument.
Examples
Here are two examples to help you understand how to adapt your script to perform an incremental migration.
With a single migration script
A Copy-Content script using incremental copy:
Import-Module Sharegate
# Define copy settings
$copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate
# Connect to source and destination sites
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm1/sites/mydestinationsite"
# Get source and destination lists
$srcList = Get-List -Name "mysrclist" -Site $srcSite
$dstList = Get-List -Name "mydstlist" -Site $dstSite
# Copy content from source list to destination list with copy settings
Copy-Content -SourceList $srcList -DestinationList $dstList -CopySettings $copysettings
With a multiple migration script using a foreach loop statement
An Import-Document script with a foreach loop statement using incremental copy:
Import-Module Sharegate
# Define CSV file path
$csvFile = "C:\MigrationPlanning\onedrivemigration.csv"
# Import CSV data into a table
$table = Import-Csv $csvFile -Delimiter ","
# Define your password
$mypassword = ConvertTo-SecureString 'mypassword' -AsPlainText -Force
# Set your migration to Incremental update.
$copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate
# Set variables for destination site and list
Set-Variable -Name dstSite, dstList
# Loop through each row in the CSV
foreach ($row in $table) {
# Clear previous variables for destination site and list
Clear-Variable -Name dstSite -ErrorAction SilentlyContinue
Clear-Variable -Name dstList -ErrorAction SilentlyContinue
# Connect to the destination site and get destination list
$dstSite = Connect-Site -Url $row.ONEDRIVEURL -Username "myusername" -Password $mypassword
$dstList = Get-List -Name "Documents" -Site $dstSite
# Import documents from source folder to destination list with copy settings
Import-Document -SourceFolder $row.DIRECTORY -DestinationList $dstList -CopySettings $copysettings
}
