PowerShell을 사용하여 SharePoint로 마이그레이션

이 문서에서는 SPMT(SharePoint 마이그레이션 도구) 마이그레이션 엔진을 기반으로 하는 새 PowerShell cmdlet에 대해 설명합니다. SharePoint 2010 및 SharePoint 2013 온-프레미스 문서 라이브러리 및 목록 항목 및 파일 공유에서 Microsoft 365로 파일을 이동하는 데 사용할 수 있습니다. SharePoint 마이그레이션과 관련된 모든 현재 PowerShell cmdlet에 대한 자세한 내용은 Microsoft SharePoint 마이그레이션 도구 cmdlet 참조를 참조하세요.

PowerShell cmdlet은 SharePoint 마이그레이션 도구와 동일한 기능을 제공합니다.

참고

이러한 PowerShell cmdlet은 현재 중국에서 21Vianet에서 운영하는 Office 365 사용자에게 제공되지 않습니다.

시스템 요구 사항

최상의 성능을 얻기 위한 권장 요구 사항

설명 권장 사항
CPU 64비트 쿼드 코어 프로세서 이상
RAM 16GB
로컬 저장소 하드 디스크: 150GB의 사용 가능한 공간
운영 체제 Windows Server 2016 Standard 또는 Datacenter
Windows Server 2012 R2
Windows 10 클라이언트
.NET Framework 4.6.2
Microsoft Visual C++ 2015 재배포 가능 OneNote 마이그레이션에 필요합니다.

중요

최대 400자의 파일 경로 마이그레이션을 지원하려면 PowerShell 5.0x 및 .NET Framework 4.6.2 이상이 필요합니다.

최소 요구 사항(성능 저하가 예상됨)

설명 최소 요구 사항
CPU 64비트 1.4GHz 2코어 프로세서 이상
RAM 8GB
로컬 저장소 하드 디스크: 150GB의 사용 가능한 공간
네트워크 카드 고속 인터넷 연결
운영 체제 Windows Server 2008 R2
Windows 7
Windows 8 또는 8.1
.NET Framework 4.6.2
Microsoft Visual C++ 2015 재배포 가능 OneNote 마이그레이션에 필요합니다.
PowerShell PowerShell 5.x는 최대 400자의 파일 경로 마이그레이션을 지원하는 데 필요합니다. PowerShell 6.0 이상은 지원되지 않습니다.

시작하기 전에

  1. 기존 Active Directory 또는 Microsoft 365에 계정을 추가하기 위한 다른 옵션 중 하나를 사용하여 Microsoft 365를 프로비전합니다. 자세한 내용은 온-프레미스 환경과 Microsoft 365 통합비즈니스용 Microsoft 365 앱 사용자 추가를 참조하세요.

  2. 폴더 열기:

    $env:UserProfile\Documents\WindowsPowerShell\Modules\Microsoft.SharePoint.MigrationTool.PowerShell

    DLL이 포함되어 있는지 확인하세요. OneDrive를 사용하는 경우 WindowsPowershell 폴더를 OneDrive /문서로 복사해야 할 수도 있습니다.

  3. 이 위치에서 다음 PowerShell 명령을 실행합니다.

    Import-Module Microsoft.SharePoint.MigrationTool.PowerShell
    

마이그레이션 세션 만들기 및 초기화

  • Register-SPMTMigration
    이 cmdlet은 마이그레이션 세션을 만든 다음 초기화합니다. 초기화는 세션 수준에서 마이그레이션 설정을 구성합니다. 특정 설정 매개 변수가 정의되지 않은 경우 기본 설정이 사용됩니다. 세션이 등록되면 세션에 작업을 추가하고 마이그레이션을 시작할 수 있습니다.

마이그레이션 작업 추가

  • Add-SPMTTask
    이 cmdlet을 사용하여 등록된 마이그레이션 세션에 새 마이그레이션 작업을 추가합니다. 현재 파일 공유 작업, SharePoint 작업 및 JSON 정의 태스크의 세 가지 작업 유형이 허용됩니다. 참고: 중복 작업은 허용되지 않습니다.

작업 제거

  • Remove-SPMTTask
    이 cmdlet을 사용하여 등록된 마이그레이션에서 기존 마이그레이션 작업을 제거합니다.

마이그레이션 시작

현재 세션의 개체 반환

  • Get-SPMTMigration
    현재 세션의 개체를 반환합니다. 여기에는 현재 작업의 상태 및 현재 세션 수준 설정이 포함됩니다. 현재 작업 상태 다음이 포함됩니다.
    • 검색한 파일의 수
    • 마이그레이션한 파일의 수
    • 마이그레이션 오류 메시지

현재 마이그레이션 중지

콘솔의 마이그레이션 상태 세부 정보 표시

  • Show-SPMTMigration
    NoShow 모드에서 마이그레이션을 시작하면 Show-SPMTMigration cmdlet을 실행하면 콘솔에 작업 ID, 데이터 원본 위치, 대상 위치 및 마이그레이션 상태 표시됩니다. Ctrl+C를 누르면 NoShow 모드로 돌아갑니다.

마이그레이션 세션 제거

샘플 시나리오

예제 1: IT 관리자는 SharePoint 온-프레미스 작업을 추가하고 백그라운드에서 마이그레이션을 시작합니다.

#Define SharePoint 2013 data source#
$SourceSiteUrl = "http://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 SharePoint 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 SharePoint 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

#Start Migration in the console. #
Start-SPMTMigration

예제 2: IT 관리자는 백그라운드 "NoShow 모드"에서 포그라운드로 마이그레이션을 전환하고 cmdlet 아래에 실행하여 콘솔에서 마이그레이션 진행 상황이 표시되도록 하려고 합니다.

Show-SPMTMigration

예제 3: IT 관리 .csv 파일을 로드하여 대량 마이그레이션을 수행하려고 합니다. 이 예제에서 샘플 파일은 SPMT.csv입니다.

Load 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
}

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

하나의 JSON 파일을 로드하여 대량 마이그레이션을 위한 코드 조각:

#Load JSON:
$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
}

spmt. json 파일에는 세 가지 마이그레이션 작업이 정의되어 있습니다.

{
   "Tasks":[
      {
         "SourcePath":"http://On-prem/sites/test",
         "TargetPath":"https://YourSPO.sharepoint.com",
         "Items":{
            "Lists":[
               {
                  "SourceList":"list-01",
                  "TargetList":"list-01"
               }
            ],
            "SubSites":[

            ]
         }
      },
      {
         "SourcePath":"http://On-prem/sites/test",
         "TargetPath":"https://YourSPO.sharepoint.com",
         "Items":{
            "Lists":[
               {
                  "SourceList":"list-02",
                  "TargetList":"list-02"
               }
            ],
            "SubSites":[

            ]
         }
      },
      {
         "SourcePath":"http://On-prem/sites/test",
         "TargetPath":"https://YourSPO.sharepoint.com",
         "Items":{
            "Lists":[
               {
                  "SourceList":"doclib-01",
                  "TargetList":"doclib-01"
               }
            ],
            "SubSites":[

            ]
         }
      }
   ]
}

예제 4: 마이그레이션 진행률 표시

다음 샘플에서는 마이그레이션 프로젝트의 진행률을 표시하는 방법을 보여줍니다. Get-SPMTMigration은(는) 현재 세션의 개체를 반환합니다. 여기에는 현재 작업 상태 및 현재 세션 수준 설정이 포함됩니다. 현재 작업의 상태는 다음과 같습니다.

  • 검색한 파일의 수
  • 필터링된 파일 수
  • 마이그레이션한 파일의 수
  • 실패한 파일 수
  • 현재 작업의 마이그레이션 진행률(0 ~ 100)
  • 현재 작업 상태
  • 마이그레이션 오류 메시지(있는 경우)가 표시됩니다.

# Start migration in the background
Start-SPMTMigration -NoShow

# Get the object of current migration
$session = Get-SPMTMigration

# Query migration status every 5 seconds until migration is finished
while ($session.Status -ne "Finished")
{
Write-Host $session.Status

    # Query migration progress of each tasks
    Foreach ($taskStatus in $session.StatusOfTasks)
    {
        $taskStatus.MigratingProgressPercentage
}

    Start-Sleep -Seconds 5
}