Steps To Follow In ShareGate Migration

Steps To Follow With The Best Practices While Doing Share Gate Migration

  1. Create the Web Apps after proper certifications and token settings using PowerShell scripts provided by the client.

  2. Execute the Inventory PowerShell script code for finding out the total reports in the below sections: Workflows, Workflows_InProgress, Workflows_Other, Lists_InfoPath, Features, Lists_All, Lists_Large, Features_Site, Features_SiteCollections.

    You need to create a CSV folder with the above CSV files ready in the required path for getting them updated.
  1. Also, make an Excel sheet of site collections and their size ranges in MB, GB of the required WebApps for migration to make an estimated timesheet schedule.PowerShell script used for this purpose is shown below.

    Get-SPWebApplication <Web App name> | Get-SPSite -limit all| Select Url, @{label="Size in MB";Expression={$_.usage.storage/1MB}}| Out-File -FilePath "C:\Output.txt"

    Please create Output text file in the mentioned path.

    1. function GetWebSizes ($StartWeb)  
    2. {  
    3.     $web = $StartWeb  
    4.     [long]$total = 0  
    5.     $total += GetWebSize -Web $web  
    6.     $total += GetSubWebSizes -Web $web  
    7.     $totalInMb = ($total/1024)/1024  
    8.     $totalInMb = "{0:N2}" -f $totalInMb  
    9.     $totalInGb = (($total/1024)/1024)/1024  
    10.     $totalInGb = "{0:N2}" -f $totalInGb  
    11.     write-host "Total size of all sites below" $StartWeb "is" $total "Bytes,"  
    12.     write-host "which is" $totalInMb "MB or" $totalInGb "GB"  
    13.     $web.Dispose()  
    14. }  
    15.   
    16. function GetWebSize ($Web)  
    17. {  
    18.     [long]$subtotal = 0  
    19.     foreach ($folder in $Web.Folders)  
    20.     {  
    21.         $subtotal += GetFolderSize -Folder $folder  
    22.     }  
    23.     write-host "Site" $Web.Title "is" $subtotal "KB"  
    24.     return $subtotal  
    25. }  
    26.   
    27. function GetWebSizePlain ($Web)  
    28. {  
    29.     [long]$subtotal = 0  
    30.     foreach ($folder in $Web.Folders)  
    31.     {  
    32.         $subtotal += GetFolderSize -Folder $folder  
    33.     }  
    34.     #write-host "Site" $Web.Title "is" $subtotal  
    35.     return $subtotal  
    36. }  
    37.   
    38. function GetSubWebSizes ($Web)  
    39. {  
    40.     [long]$subtotal = 0  
    41.     foreach ($subweb in $Web.GetSubwebsForCurrentUser())  
    42.     {  
    43.         [long]$webtotal = 0  
    44.         foreach ($folder in $subweb.Folders)  
    45.         {  
    46.             $webtotal += GetFolderSize -Folder $folder  
    47.         }  
    48.         #write-host "Site" $subweb.Title "is" $webtotal "Bytes"  
    49.         $subtotal += $webtotal  
    50.         $subtotal += GetSubWebSizes -Web $subweb  
    51.     }  
    52.     return $subtotal  
    53. }  
    54.   
    55. function GetFolderSize ($Folder)  
    56. {  
    57.     [long]$folderSize = 0    
    58.     foreach ($file in $Folder.Files)  
    59.     {  
    60.         $folderSize += $file.Length;  
    61.     }  
    62.     foreach ($fd in $Folder.SubFolders)  
    63.     {  
    64.         $folderSize += GetFolderSize -Folder $fd  
    65.     }  
    66.     return $folderSize  
    67. }  
    68.   
    69. $CountWorkflows= 0  
    70. $CountWorkflowsTotal= 0  
    71. $CountWorkflowsInProgress = 0  
    72. $CountWorkflowsInProgressTotal = 0  
    73. $CountWorkflowsOther = 0  
    74. $CountWorkflowsOtherTotal = 0  
    75. $SiteAdmins = ""  
    76. $FullControl = ""   
    77.   
    78. $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent  
    79. New-Item -ItemType Directory -Force -Path $scriptBase"\csv"  
    80. $scriptBase = $scriptBase + "\csv"  
    81. Set-Location $scriptBase  
    82.   
    83. $WorkflowsFile = $scriptbase + "\" + "Workflows.csv"    
    84.     "Site" + "," + "SiteGUID" + "," + "List" + "," + "WorkflowName" + "," + "Count" | Out-File -Encoding Default -FilePath $WorkflowsFile    
    85. $InProgressWorkflowsFile = $scriptbase + "\" + "Workflows_InProgress.csv"    
    86.     "Site" + "," + "SiteGUID" + "," + "List" + "," + "ItemName" + "," + "ItemGUID" + "," + "WorkflowInstanceID" | Out-File -Encoding Default -FilePath $InProgressWorkflowsFile    
    87. $OtherWorkflows = $scriptbase + "\" + "Workflows_Other.csv"    
    88.     "Site" + "," + "SiteGUID" + "," + "List" + "," + "ItemName" + "," + "ItemGUID" + "," + "WorkflowInstanceID" | Out-File -Encoding Default -FilePath $OtherWorkflows  
    89. $InfoPathLibs = $scriptbase + "\" + "Lists_InfoPath.csv"  
    90.     "Site, SiteGUID , List Name , List Url , Docs Count , Last Modified , WF Count , Live WF , Live WF Names , Form Template" | Out-File -Encoding Default -FilePath $InfoPathLibs  
    91. $SitesFile = $scriptbase + "\" + "Sites.csv"  
    92.     "Site,ID,ParentWebID,SiteCollectionID, Last Modified , WebTemplate , WebTemplateID , Unique Permissions , Size , Site Collection Admins , Full Control Users , Unique Workflows , Workflows in Progress, Workflows non complete state" | Out-File -Encoding Default -FilePath $SitesFile  
    93.   
    94. $AllLists = "Lists_All.csv"  
    95. "SiteURL,SiteGUID,ParentWebID,ListName , Size , ItemCount , Template , LastModified" | Out-File -Encoding Default -FilePath $AllLists  
    96. $LargeLists = "Lists_Large.csv"  
    97. "SiteURL,SiteGUID,ParentWebID,ListName , Size , ItemCount , Template, LastModified" | Out-File -Encoding Default -FilePath $LargeLists  
    98.   
    99. $SiteCollectionsFile = $scriptbase + "\" + "SiteCollections.csv"    
    100. $WebAppsOut = $scriptbase + "\" + "WebApps.csv"  
    101. $ServersOut = $scriptbase + "\" + "Servers.csv"  
    102. $ServiceAppsOut  = $scriptbase + "\" + "ServiceApp.csv"  
    103.   
    104. $FeaturesFile = "Features_Site.csv"  
    105. "SiteURL,SiteGUID,Feature_ID,Feature_Name,State" | Out-File -Encoding Default -FilePath $FeaturesFile  
    106. $SiteCollectionsFeaturesFile = "Features_SiteCollections.csv"  
    107. "SiteCollectionURL,SiteCollectionGUID,Feature_ID,Feature_Name,State" | Out-File -Encoding Default -FilePath $SiteCollectionsFeaturesFile  
    108. Get-SPServer | Select DisplayName, Role | Export-CSV $ServersOut  
    109. Get-SPServiceApplication | Select DisplayName,{$_.ApplicationPool.Name} | Export-CSV $ServiceAppsOut  
    110. Get-SPWebApplication | Select DisplayName,Url, {$_.AlternateUrls.Count}, {$_.AlternateUrls.Uri} | Export-CSV $WebAppsOut  
    111. Get-SPSite -Limit All | Select Url, Owner,{$_.Quota.StorageMaximumLevel},ID | Export-CSV $SiteCollectionsFile  
    112.   
    113.   
    114. Get-SPSite "http://gateway2013.softura.com/" | Get-SPWeb -Limit All  | foreach {  
    115.     $SiteAdmins = ""  
    116.     $FullControl = ""  
    117.     $CountWorkflows = 0  
    118.     $CountWorkflowsInProgress = 0  
    119.     $CountWorkflowsOther = 0      
    120.   
    121.     $subwebtitle =  $_.Title + "_"  
    122.  
    123.     ##$FeaturesFile = $_.Title + "_Features.csv"  
    124.           
    125.       
    126.   
    127.     $subWeb = $_  
    128.       
    129.     if($subWeb.Url -eq $subWeb.Site.Url)  
    130.      {  
    131.            
    132.       $siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Site" }  
    133.       if ($siteFeatures -ne $null)  
    134.       {  
    135.        foreach ($feature in $siteFeatures)  
    136.        {  
    137.         # Actived feature  
    138.         if ((Get-SPFeature -Site $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -ne $null)  
    139.         {  
    140.             $subWeb.Site.URL + "," + $subWeb.Site.ID.ToString() + "," + $feature.Id.ToString() + "," + $feature.DisplayName + ",activated" | Out-File -Encoding Default -Append -FilePath $SiteCollectionsFeaturesFile  
    141.         }  
    142.         # DeActived feature  
    143.         elseif ((Get-SPFeature -Site $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -eq $null)  
    144.         {  
    145.             $subWeb.Site.URL + "," + $subWeb.Site.ID.ToString() + "," + $feature.Id.ToString() + "," + $feature.DisplayName + ",deactivated" | Out-File -Encoding Default -Append -FilePath $SiteCollectionsFeaturesFile  
    146.         }  
    147.        }  
    148.       }  
    149.      }  
    150.       
    151.     $siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Web" }  
    152.      if ($siteFeatures -ne $null)  
    153.      {  
    154.       foreach ($feature in $siteFeatures)  
    155.       {  
    156.        # Actived feature  
    157.        if ((Get-SPFeature -Web $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -ne $null)  
    158.        {  
    159.           $subWeb.Url + "," + $subWeb.Id.ToString() + "," + $feature.Id.ToString() + "," + $feature.DisplayName + ",activated" | Out-File -Encoding Default -Append -FilePath $FeaturesFile  
    160.        }  
    161.        # DeActived feature  
    162.        elseif ((Get-SPFeature -Web $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -eq $null)  
    163.        {  
    164.           $subWeb.Url + "," + $subWeb.Id.ToString() + "," +$feature.Id.ToString() + "," + $feature.DisplayName + ",deactivated" |Out-File -Encoding Default -Append -FilePath $FeaturesFile  
    165.        }  
    166.       }  
    167.      }  
    168.   
    169.   
    170.     ""   
    171.     ""+$_.url  
    172.     "  GUID:"+$_.ID  
    173.     "  Parent GUID:"+$_.ParentWebID  
    174.     "  Site Collection GUID:"+$_.Site.ID  
    175.     "  LastItemModifiedDate: " + $_.LastItemModifiedDate  
    176.     "  WebTemplate: " + $_.WebTemplate  
    177.     "  WebTemplateID: " + $_.WebTemplateID  
    178.     "  Web has unique permissions: " + $_.HasUniquePerm  
    179.     GetWebSizes ($_)  
    180.   
    181.     $Size = GetWebSizePlain($_)  
    182.     # the Site Collection Administrators  
    183.     " Site Collection Administrators:"  
    184.     foreach ($user in $_.SiteAdministrators)  
    185.     {        
    186.        "  " + $user.DisplayName + " " + $user.UserLogin  
    187.        $SiteAdmins = $SiteAdmins + $user.DisplayName + " " + $user.UserLogin + "`n"  
    188.     }  
    189.  
    190.     # full control users  
    191.     " Full Control Users:"  
    192.     foreach ($user in $_.Users)  
    193.     {  
    194.        if ( $_.DoesUserHavePermissions($user,[Microsoft.SharePoint.SPBasePermissions]::FullMask) )        
    195.        {   
    196.          "  " + $user.DisplayName + " " + $user.UserLogin  
    197.          $FullControl = $FullControl + $user.DisplayName + " " + $user.UserLogin + "`n"  
    198.        }  
    199.     }  
    200.       
    201.       
    202.      $_.Lists | foreach { $_.WorkflowAssociations | foreach {   
    203.         ##write-host "Site URL :" $_.ParentWeb.Url ", List Name :" $_.ParentList.Title ", Workflow Name :" $_.Name ", Workflow Count :" $_.ItemGUID  
    204.         $_.ParentList.ParentWeb.URL + "," + $_.ParentList.ParentWeb.ID + "," + $_.ParentList.Title + "," + $_.Name + "," + $_.Count | Out-File -Encoding Default  -Append -FilePath $WorkflowsFile;    
    205.         $CountWorkflows = $CountWorkflows + 1  
    206.      } }  
    207.   
    208.        
    209.      foreach($list in $_.Lists)    
    210.             {  
    211.             $listSize = 0  
    212.             foreach ($item in $list.items)   
    213.             {   
    214.                 $listSize += ($item.file).length  
    215.             }  
    216.             $list.ParentWeb.URL + "," +  $list.ParentWeb.ID +"," + $list.title + ","+ $listSize + "," + $list.ItemCount+ "," + $list.BaseTemplate + "," + $list.LastItemModifiedDate.ToShortDateString() | Out-File -Encoding Default -Append -FilePath $AllLists  
    217.             if( $list.ItemCount -gt 2000 )  
    218.             {  
    219.                 $list.ParentWeb.URL + "," +  $list.ParentWeb.ID +"," + $list.title + ","+ $listSize + "," + $list.ItemCount+ "," + $list.BaseTemplate + "," + $list.LastItemModifiedDate.ToShortDateString() | Out-File -Encoding Default -Append -FilePath $LargeLists  
    220.             }  
    221.               
    222.             if( $list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -eq "XMLForm")  
    223.             {  
    224.                 $listModDate = $list.LastItemModifiedDate.ToShortDateString()  
    225.                 $listTemplate = $list.ServerRelativeDocumentTemplateUrl  
    226.                 $listWorkflowCount = $list.WorkflowAssociations.Count  
    227.                 $listLiveWorkflowCount = 0  
    228.                 $listLiveWorkflows = ""  
    229.                 foreach ($wf in $list.WorkflowAssociations)  
    230.                 {  
    231.                     if ($wf.Enabled)  
    232.                     {  
    233.                         $listLiveWorkflowCount++  
    234.                         if ($listLiveWorkflows.Length -gt 0)  
    235.                         {  
    236.                             $listLiveWorkflows = "$listLiveWorkflows, $($wf.Name)"  
    237.                         }  
    238.                         else  
    239.                         {  
    240.                             $listLiveWorkflows = $wf.Name  
    241.                         }  
    242.                     }  
    243.                 }  
    244.                 $list.ParentWeb.URL +"," + $list.ParentWeb.ID +"," + $list.title +"," + $_.ParentWeb.Url + "/" + $list.RootFolder.Url  +"," + $list.ItemCount +"," + $listModDate +"," + $listWorkflowCount +"," + $listLiveWorkflowCount +"," + $listLiveWorkflows +"," + $listTemplate | Out-File -Encoding Default -Append -FilePath $InfoPathLibs  
    245.             }    
    246.                 foreach($item in $list.items)    
    247.                 {    
    248.                     foreach($workflow in $item.workflows)    
    249.                     {    
    250.                         if($workflow.iscompleted -eq $false)    
    251.                         {    
    252.                            $list.ParentWeb.URL + "," + $list.ParentWeb.ID + "," + $list.Title + "," + $workflow.ItemName + "," + $workflow.ItemGUID + "," + $workflow.InstanceId | Out-File -Encoding Default  -Append -FilePath $InProgressWorkflowsFile;    
    253.                            $CountWorkflowsInProgress++  
    254.                         }    
    255.                         else    
    256.                         {    
    257.                            $list.ParentWeb.URL + "," + $list.ParentWeb.ID + "," + $list.Title + "," + $workflow.ItemName + "," + $workflow.ItemGUID + "," + $workflow.InstanceId | Out-File -Encoding Default  -Append -FilePath $OtherWorkflows;    
    258.                            $CountWorkflowsOther++  
    259.                         }    
    260.                     }    
    261.                 }    
    262.             }  
    263.             " WorkFlows:"+ $CountWorkflows  
    264.                 $CountWorkflowsTotal = $CountWorkflowsTotal+$CountWorkflows  
    265.             " WorkFlows InProgress:" + $CountWorkflowsInProgress  
    266.                 $CountWorkflowsInProgressTotal = $CountWorkflowsInProgressTotal+ $CountWorkflowsInProgress  
    267.             " WorkFlows Other States:" + $CountWorkflowsOther  
    268.                 $CountWorkflowsOtherTotal = $CountWorkflowsOtherTotal + $CountWorkflowsOther  
    269.             $_.url + "," + $_.ID + "," + $_.ParentWebID + "," + $_.Site.ID + "," + $_.LastItemModifiedDate  + "," + $_.WebTemplate + "," + $_.WebTemplateID + "," + $_.HasUniquePerm + "," + $Size + "," + "`"$SiteAdmins`"" + "," + "`"$FullControl`"" + "," + $CountWorkflows + "," + $CountWorkflowsInProgress + "," + $CountWorkflowsOther| Out-File -Encoding Default  -Append -FilePath $SitesFile;    
    270.   
    271.   }  
    272.   "Total Workflows:" + $CountWorkflowsTotal  
    273.   "Total Workflows In Progress:" + $CountWorkflowsInProgressTotal  
    274.   "Total Workflows In Other States:" + $CountWorkflowsOtherTotal  
  1. Give Site Collection Admin permission to the user id in both the source and destination site collections.

  2. Check the features in both the source and destination, and activate whichever ones are not yet activated in the destination site collection.

  3. Run as administrator on the ShareGate tool and launch Migration.

  4. Connect the source destination with valid authentication.

  5. Run the Pre-Check report to solve errors and warnings in bulk.

  6. Map the Unresolved Users and Groups to an SPFarmAdmin id to avoid users not found errors /warnings, as shown below in the screenshot.


  1. Similarly, do the necessary Site Template mappings.


  1. Similarly, do the necessary Permissions mappings.


  1. Select the top site if sub sites are also available for migration, as ShareGate automatically selects all of them to migrate.


  1. Start migration with the below settings.


  1. You can also generate the report and start validating to solve the errors /warnings.


  2. Check the help links from the migration report to resolve the errors/warnings. If not available, kindly share the report with the ShareGate Support team and describe your errors/warnings to get a proper solution to fix it.
That's it. I hope you liked this article.

Up Next
    Ebook Download
    View all
    Learn
    View all