다음을 통해 공유


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 이상은 지원되지 않습니다.

긴 경로 문제에 대한 해결 방법

SPMT PowerShell을 사용하는 경우 경로가 260자보다 긴 원본 파일에서 검색 오류가 발생할 수 있습니다. 이 문제를 resolve 위해 PowerShell이 긴 경로 파일을 읽을 수 있도록 시스템 레지스트리를 수정할 수 있습니다.

편집기 등록을 열고 로 이동하여 "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework"새 키를 "AppContext"추가합니다. 그런 다음 키 아래에 2 문자열 값을 추가합니다.

  • 값 이름: Switch.System.IO.BlockLongPaths 값 데이터: false

  • 값 이름: Switch.System.IO.UseLegacyPathHandling 값 데이터: false

시작하기 전에

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

  2. 폴더 $env:UserProfile\Documents\WindowsPowerShell\Modules\Microsoft.SharePoint.MigrationTool.PowerShell 를 엽니다. 내부에 DLL이 있는지 확인합니다. OneDrive를 사용하는 경우 WindowsPowershell 폴더를 에 $env:UserProfile\OneDrive - Microsoft\Documents복사해야 합니다.

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

    Import-Module Microsoft.SharePoint.MigrationTool.PowerShell
    

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

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

마이그레이션 작업 추가

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

작업 제거

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

마이그레이션 시작

이 cmdlet은 등록된 SPMT 마이그레이션을 시작합니다.

현재 세션의 개체 반환

현재 세션의 개체를 반환합니다. 이 cmdlet에는 현재 작업 및 현재 세션 수준 설정의 상태 포함됩니다. 현재 작업 상태 다음이 포함됩니다.

S - 스캔한 파일 수

  • 마이그레이션한 파일의 수
    • 마이그레이션 오류 메시지

현재 마이그레이션 중지

이 cmdlet은 현재 마이그레이션을 취소합니다.

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

NoShow 모드에서 마이그레이션을 시작하면 Show-SPMTMigration cmdlet을 실행하면 콘솔에 작업 ID, 데이터 원본 위치, 대상 위치 및 마이그레이션 상태 표시됩니다. Ctrl+C를 선택하면 디스플레이가 NoShow 모드로 반환됩니다.

마이그레이션 세션 제거

이 cmdlet을 사용하여 마이그레이션 세션을 삭제합니다.

샘플 시나리오

예제 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
}