Add a new migration task to the registered migration session. Currently there are three different
types of tasks allowed: File Share task, SharePoint task and JSON defined task.
Examples
EXAMPLE 1
This example adds one File Share migration task and one SharePoint 2013 migration task to the
registered migration session.
#Define SharePoint 2013 data source#
$SourceSiteUrl = "https://YourOnPremSite/"
$OnPremUserName = "Yourcomputer\administrator"
$OnPremPassword = ConvertTo-SecureString -String "OnPremPassword" -AsPlainText -Force
$SPCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $OnPremUserName, $OnPremPassword
$SourceListName = "SourceListName"
#Define SPO target#
$SPOUrl = "https://contoso.sharepoint.com"
$UserName = "admin@contoso.onmicrosoft.com"
$PassWord = ConvertTo-SecureString -String "YourSPOPassword" -AsPlainText -Force
$SPOCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $PassWord
$TargetListName = "TargetListName"
#Define File Share data source#
$FileshareSource = "YourFileShareDataSource"
#Import SPMT Migration Module#
Import-Module Microsoft.SharePoint.MigrationTool.PowerShell
#Register the SPMT session with SPO credentials#
Register-SPMTMigration -SPOCredential $SPOCredential -Force
# Add two tasks into the session. One is SharePoint migration task, and another is
# File Share migration task.#
Add-SPMTTask -SharePointSourceCredential $SPCredential -SharePointSourceSiteUrl $SourceSiteUrl -TargetSiteUrl $SPOUrl -MigrateAll
Add-SPMTTask -FileShareSource $FileshareSource -TargetSiteUrl $SPOUrl -TargetList $TargetListName
EXAMPLE 2
This example adds a new migration task to the registered migration session. Currently there are
three different types of tasks allowed: File Share task, SharePoint task and JSON defined task.
# Code snippets for bulk migration by loading the sample CSV with the name of spmt.csv
$csvItems = import-csv "C:\spmt.csv" -Header c1,c2,c3,c4,c5,c6
ForEach ($item in $csvItems) {
Write-Host $item.c1
Add-SPMTTask -FileShareSource $item.c1 -TargetSiteUrl $item.c4 -TargetList $item.c5 -TargetListRelativePath $item.c6
}
# Two migration tasks are defined in the file spmt.csv
D:\MigrationTest\Files\Average_1M\c,,,https://SPOSite.sharepoint.com,Documents,Test
C:\work\Powershell\negative,,,https://SPOSite.sharepoint.com/,Documents,DocLibrary_SubfolderName
# Code snippets for bulk migration by loading one JSON file:
$jsonItems = Get-Content -Raw -Path "C:\spmt.json" | ConvertFrom-Json
ForEach ($taskItem in $jsonItems.Tasks) {
$jsonString = ConvertTo-Json $taskItem -Depth 100
Add-SPMTTask -JsonDefinition $jsonString -SharePointSourceCredential $onpremCredential
}
This parameter is mandatory for File Share migration. Please specify the source folder path. For
example: C:\SourceFiles.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
FileShare
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-JsonDefinition
Define one File share task or SharePoint task in JSON format.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
Json
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-MigrateAll
This is a switch parameter. If set to True, all lists will be migrated. If set to False, the
customer will migrate selected lists.
Parameter properties
Type:
System.Management.Automation.SwitchParameter
Default value:
False
Supports wildcards:
False
DontShow:
False
Parameter sets
SharePointMigrateAll
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-MigrationType
{{ Fill MigrationType Description }}
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-SharePointSourceCredential
Use this parameter to define SharePoint 2013 sign-in credentials.
Parameter properties
Type:
System.Management.Automation.PSCredential
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
SharePointMigrateAll
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
SharePointMigrateSelected
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
Json
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-SharePointSourceSiteUrl
Use this parameter to define SharePoint data source site URL.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
SharePointMigrateAll
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
SharePointMigrateSelected
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-SourceList
This parameter is mandatory and is to define source document library name or list name.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
SharePointMigrateSelected
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-SourceListRelativePath
This parameter is optional and is to define data source relative path.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
SharePointMigrateSelected
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-TargetList
This parameter is mandatory and is to define target library name or list name.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
FileShare
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
SharePointMigrateSelected
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-TargetListRelativePath
This parameter is optional and is to define target relative path.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
FileShare
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
SharePointMigrateSelected
Position:
Named
Mandatory:
False
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
-TargetSiteUrl
This parameter is mandatory for both File Share and SharePoint migration and is to define the target
site URL.
Parameter properties
Type:
System.String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
FileShare
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
SharePointMigrateAll
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
SharePointMigrateSelected
Position:
Named
Mandatory:
True
Value from pipeline:
False
Value from pipeline by property name:
False
Value from remaining arguments:
False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
Feedback
Was this page helpful?
No
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?