Share via


User PowerShell to automate migration

The PowerShell cmdlet is designed to manage file share migration tasks running in Migration Manager service, and download scan and migration reports.

Refer to this link to make sure your computer meet the system requirements.

Before you start

To start Migration Manager file share migration:

  1. Install Migration Manager Agents, then connect them to the destination tenant with an admin account.
  2. Sign into the SharePoint Admin Center as an admin and navigate to Migration/File Share.

 Download the PowerShell zip file here, and unzip the build into a working folder

Use the PowerShell cmdlet

Launch PowerShell as Administrator

Run the following commands:

> Get-ChildItem -Path "working_folder" -Recurse | Unblock-File

> Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

Close the first PowerShell window and launch PowerShell as Administrator

Run the following commands:

> Import-Module "working_folder\Microsoft.SharePoint.MigrationManager.PowerShell.dll"

Note

Provide an absolute file path in the Import-Module cmdlet.

Connect to the Migration Manager service

> Connect-MigrationService

This cmdlet connects to the Migration Manager service. After a connection is established, you can add migration tasks and start migration.

Add a migration task

> Add-MigrationTask

Use this cmdlet to create a new migration task. After creation, the task appears on the Migration Manager page.

The following parameters are required:

  • TaskName: Specifies the name of the migration task.

  • SourceUri: Defines the source file path.

  • TargetSiteUrl: Indicates the destination SharePoint site URL.

  • TargetListName: Specifies the name of the destination SharePoint list.

Optional parameters:

  • ScheduleStartTime: Specifies the time the task starts to execute. By default, a task starts right after you add it.

  • AgentGroup: Assign an agent group to execute the task. By default, "Default" group is assigned.

  • Tags: Assign tags to the task. To assign more than one tag, semi-colon is used to separate the tag values.

Output message:

  • "Migration task is created with task ID taskId" if the task is successfully added into the migration service.

  • "Failed to add migration task. errorMessage" if the cmdlet errors out.

For a complete list of supported parameters, run:

> Get-Help Add-MigrationTask -Full

Get migration reports

> Get-MigrationReport

Use this cmdlet to retrieve reports of completed migration tasks based on the specified parameters:

  • OutputPath: Specifies the directory path where the generated reports are saved.

  • StartTime: Filters migration tasks that started after the specified date and time.

  • EndTime: Filters migration tasks that started before the specified date and time.

  • TaskNameContains: Filters migration tasks whose names contain the specified keyword.

  • Tags: Filters migration tasks whose tag is same as the given parameter. If more than tags are given, separated by a semicolon (;), all tasks whose tag is same as one in the tags parameter should be returned.

  • Status: Filters migration tasks whose status is same as the given parameter. Supported values are Completed and Failed. By default, reports of Completed and Failed tasks are downloaded.

If no parameters are specified, the cmdlet defaults to downloading all Completed and Failed reports.

Output message:

  • "Report downloaded for task taskeId" for each task if the report zip file is downloaded. And the last message is a summary line "Migration reports downloading completed, check the output folder: outputPath"

  • "Failed to download migration report. errorMessage" if the cmdlet errors out.

For a complete list of supported parameters, run:

> Get-Help Get-MigrationReport -Full

Get scan reports

> Get-ScanReport

Use this cmdlet to retrieve reports of completed scan tasks based on the specified parameter

  • OutputPath: Specifies the directory path where the generated reports are saved.

  • StartTime: Filters migration tasks that started after the specified date and time.

  • EndTime: Filters migration tasks that started before the specified date and time.

  • Tags: Filters migration tasks whose tag is same as the given parameter. If more than tags are given, separated by a semicolon (;), all tasks whose tag is same as one in the tags parameter should be returned.

  • Status: Filters migration tasks whose status is same as the given parameter. Supported values are Ready, Warning, and Error. By default, reports of Ready to migrate, Warning, and Error tasks are downloaded.

If no parameters are specified, the cmdlet defaults to downloading all Ready to migrate, Warning, and Error reports.

Output message:

  • "Scan log downloaded for task taskeid" for each task if the report zip file is downloaded. And the last message is a summary line "Scan logs downloading completed, check the output folder: outputPath".

  • "Failed to download scan log. error_message" if the cmdlet errors out.

For a complete list of supported parameters, run:

> Get-Help Get-ScanReport -Full