Steps To Follow With The Best Practices While Doing Share Gate Migration
- Create the Web Apps after proper certifications and token settings using PowerShell scripts provided by the client.
- 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.
- 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.
- function GetWebSizes ($StartWeb)
- {
- $web = $StartWeb
- [long]$total = 0
- $total += GetWebSize -Web $web
- $total += GetSubWebSizes -Web $web
- $totalInMb = ($total/1024)/1024
- $totalInMb = "{0:N2}" -f $totalInMb
- $totalInGb = (($total/1024)/1024)/1024
- $totalInGb = "{0:N2}" -f $totalInGb
- write-host "Total size of all sites below" $StartWeb "is" $total "Bytes,"
- write-host "which is" $totalInMb "MB or" $totalInGb "GB"
- $web.Dispose()
- }
-
- function GetWebSize ($Web)
- {
- [long]$subtotal = 0
- foreach ($folder in $Web.Folders)
- {
- $subtotal += GetFolderSize -Folder $folder
- }
- write-host "Site" $Web.Title "is" $subtotal "KB"
- return $subtotal
- }
-
- function GetWebSizePlain ($Web)
- {
- [long]$subtotal = 0
- foreach ($folder in $Web.Folders)
- {
- $subtotal += GetFolderSize -Folder $folder
- }
- #write-host "Site" $Web.Title "is" $subtotal
- return $subtotal
- }
-
- function GetSubWebSizes ($Web)
- {
- [long]$subtotal = 0
- foreach ($subweb in $Web.GetSubwebsForCurrentUser())
- {
- [long]$webtotal = 0
- foreach ($folder in $subweb.Folders)
- {
- $webtotal += GetFolderSize -Folder $folder
- }
- #write-host "Site" $subweb.Title "is" $webtotal "Bytes"
- $subtotal += $webtotal
- $subtotal += GetSubWebSizes -Web $subweb
- }
- return $subtotal
- }
-
- function GetFolderSize ($Folder)
- {
- [long]$folderSize = 0
- foreach ($file in $Folder.Files)
- {
- $folderSize += $file.Length;
- }
- foreach ($fd in $Folder.SubFolders)
- {
- $folderSize += GetFolderSize -Folder $fd
- }
- return $folderSize
- }
-
- $CountWorkflows= 0
- $CountWorkflowsTotal= 0
- $CountWorkflowsInProgress = 0
- $CountWorkflowsInProgressTotal = 0
- $CountWorkflowsOther = 0
- $CountWorkflowsOtherTotal = 0
- $SiteAdmins = ""
- $FullControl = ""
-
- $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
- New-Item -ItemType Directory -Force -Path $scriptBase"\csv"
- $scriptBase = $scriptBase + "\csv"
- Set-Location $scriptBase
-
- $WorkflowsFile = $scriptbase + "\" + "Workflows.csv"
- "Site" + "," + "SiteGUID" + "," + "List" + "," + "WorkflowName" + "," + "Count" | Out-File -Encoding Default -FilePath $WorkflowsFile
- $InProgressWorkflowsFile = $scriptbase + "\" + "Workflows_InProgress.csv"
- "Site" + "," + "SiteGUID" + "," + "List" + "," + "ItemName" + "," + "ItemGUID" + "," + "WorkflowInstanceID" | Out-File -Encoding Default -FilePath $InProgressWorkflowsFile
- $OtherWorkflows = $scriptbase + "\" + "Workflows_Other.csv"
- "Site" + "," + "SiteGUID" + "," + "List" + "," + "ItemName" + "," + "ItemGUID" + "," + "WorkflowInstanceID" | Out-File -Encoding Default -FilePath $OtherWorkflows
- $InfoPathLibs = $scriptbase + "\" + "Lists_InfoPath.csv"
- "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
- $SitesFile = $scriptbase + "\" + "Sites.csv"
- "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
-
- $AllLists = "Lists_All.csv"
- "SiteURL,SiteGUID,ParentWebID,ListName , Size , ItemCount , Template , LastModified" | Out-File -Encoding Default -FilePath $AllLists
- $LargeLists = "Lists_Large.csv"
- "SiteURL,SiteGUID,ParentWebID,ListName , Size , ItemCount , Template, LastModified" | Out-File -Encoding Default -FilePath $LargeLists
-
- $SiteCollectionsFile = $scriptbase + "\" + "SiteCollections.csv"
- $WebAppsOut = $scriptbase + "\" + "WebApps.csv"
- $ServersOut = $scriptbase + "\" + "Servers.csv"
- $ServiceAppsOut = $scriptbase + "\" + "ServiceApp.csv"
-
- $FeaturesFile = "Features_Site.csv"
- "SiteURL,SiteGUID,Feature_ID,Feature_Name,State" | Out-File -Encoding Default -FilePath $FeaturesFile
- $SiteCollectionsFeaturesFile = "Features_SiteCollections.csv"
- "SiteCollectionURL,SiteCollectionGUID,Feature_ID,Feature_Name,State" | Out-File -Encoding Default -FilePath $SiteCollectionsFeaturesFile
- Get-SPServer | Select DisplayName, Role | Export-CSV $ServersOut
- Get-SPServiceApplication | Select DisplayName,{$_.ApplicationPool.Name} | Export-CSV $ServiceAppsOut
- Get-SPWebApplication | Select DisplayName,Url, {$_.AlternateUrls.Count}, {$_.AlternateUrls.Uri} | Export-CSV $WebAppsOut
- Get-SPSite -Limit All | Select Url, Owner,{$_.Quota.StorageMaximumLevel},ID | Export-CSV $SiteCollectionsFile
-
-
- Get-SPSite "http://gateway2013.softura.com/" | Get-SPWeb -Limit All | foreach {
- $SiteAdmins = ""
- $FullControl = ""
- $CountWorkflows = 0
- $CountWorkflowsInProgress = 0
- $CountWorkflowsOther = 0
-
- $subwebtitle = $_.Title + "_"
-
- ##$FeaturesFile = $_.Title + "_Features.csv"
-
-
-
- $subWeb = $_
-
- if($subWeb.Url -eq $subWeb.Site.Url)
- {
-
- $siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Site" }
- if ($siteFeatures -ne $null)
- {
- foreach ($feature in $siteFeatures)
- {
- # Actived feature
- if ((Get-SPFeature -Site $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -ne $null)
- {
- $subWeb.Site.URL + "," + $subWeb.Site.ID.ToString() + "," + $feature.Id.ToString() + "," + $feature.DisplayName + ",activated" | Out-File -Encoding Default -Append -FilePath $SiteCollectionsFeaturesFile
- }
- # DeActived feature
- elseif ((Get-SPFeature -Site $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -eq $null)
- {
- $subWeb.Site.URL + "," + $subWeb.Site.ID.ToString() + "," + $feature.Id.ToString() + "," + $feature.DisplayName + ",deactivated" | Out-File -Encoding Default -Append -FilePath $SiteCollectionsFeaturesFile
- }
- }
- }
- }
-
- $siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Web" }
- if ($siteFeatures -ne $null)
- {
- foreach ($feature in $siteFeatures)
- {
- # Actived feature
- if ((Get-SPFeature -Web $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -ne $null)
- {
- $subWeb.Url + "," + $subWeb.Id.ToString() + "," + $feature.Id.ToString() + "," + $feature.DisplayName + ",activated" | Out-File -Encoding Default -Append -FilePath $FeaturesFile
- }
- # DeActived feature
- elseif ((Get-SPFeature -Web $subWeb.Url | Where-Object {$_.Id -eq $feature.id}) -eq $null)
- {
- $subWeb.Url + "," + $subWeb.Id.ToString() + "," +$feature.Id.ToString() + "," + $feature.DisplayName + ",deactivated" |Out-File -Encoding Default -Append -FilePath $FeaturesFile
- }
- }
- }
-
-
- ""
- ""+$_.url
- " GUID:"+$_.ID
- " Parent GUID:"+$_.ParentWebID
- " Site Collection GUID:"+$_.Site.ID
- " LastItemModifiedDate: " + $_.LastItemModifiedDate
- " WebTemplate: " + $_.WebTemplate
- " WebTemplateID: " + $_.WebTemplateID
- " Web has unique permissions: " + $_.HasUniquePerm
- GetWebSizes ($_)
-
- $Size = GetWebSizePlain($_)
- # the Site Collection Administrators
- " Site Collection Administrators:"
- foreach ($user in $_.SiteAdministrators)
- {
- " " + $user.DisplayName + " " + $user.UserLogin
- $SiteAdmins = $SiteAdmins + $user.DisplayName + " " + $user.UserLogin + "`n"
- }
-
- # full control users
- " Full Control Users:"
- foreach ($user in $_.Users)
- {
- if ( $_.DoesUserHavePermissions($user,[Microsoft.SharePoint.SPBasePermissions]::FullMask) )
- {
- " " + $user.DisplayName + " " + $user.UserLogin
- $FullControl = $FullControl + $user.DisplayName + " " + $user.UserLogin + "`n"
- }
- }
-
-
- $_.Lists | foreach { $_.WorkflowAssociations | foreach {
- ##write-host "Site URL :" $_.ParentWeb.Url ", List Name :" $_.ParentList.Title ", Workflow Name :" $_.Name ", Workflow Count :" $_.ItemGUID
- $_.ParentList.ParentWeb.URL + "," + $_.ParentList.ParentWeb.ID + "," + $_.ParentList.Title + "," + $_.Name + "," + $_.Count | Out-File -Encoding Default -Append -FilePath $WorkflowsFile;
- $CountWorkflows = $CountWorkflows + 1
- } }
-
-
- foreach($list in $_.Lists)
- {
- $listSize = 0
- foreach ($item in $list.items)
- {
- $listSize += ($item.file).length
- }
- $list.ParentWeb.URL + "," + $list.ParentWeb.ID +"," + $list.title + ","+ $listSize + "," + $list.ItemCount+ "," + $list.BaseTemplate + "," + $list.LastItemModifiedDate.ToShortDateString() | Out-File -Encoding Default -Append -FilePath $AllLists
- if( $list.ItemCount -gt 2000 )
- {
- $list.ParentWeb.URL + "," + $list.ParentWeb.ID +"," + $list.title + ","+ $listSize + "," + $list.ItemCount+ "," + $list.BaseTemplate + "," + $list.LastItemModifiedDate.ToShortDateString() | Out-File -Encoding Default -Append -FilePath $LargeLists
- }
-
- if( $list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -eq "XMLForm")
- {
- $listModDate = $list.LastItemModifiedDate.ToShortDateString()
- $listTemplate = $list.ServerRelativeDocumentTemplateUrl
- $listWorkflowCount = $list.WorkflowAssociations.Count
- $listLiveWorkflowCount = 0
- $listLiveWorkflows = ""
- foreach ($wf in $list.WorkflowAssociations)
- {
- if ($wf.Enabled)
- {
- $listLiveWorkflowCount++
- if ($listLiveWorkflows.Length -gt 0)
- {
- $listLiveWorkflows = "$listLiveWorkflows, $($wf.Name)"
- }
- else
- {
- $listLiveWorkflows = $wf.Name
- }
- }
- }
- $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
- }
- foreach($item in $list.items)
- {
- foreach($workflow in $item.workflows)
- {
- if($workflow.iscompleted -eq $false)
- {
- $list.ParentWeb.URL + "," + $list.ParentWeb.ID + "," + $list.Title + "," + $workflow.ItemName + "," + $workflow.ItemGUID + "," + $workflow.InstanceId | Out-File -Encoding Default -Append -FilePath $InProgressWorkflowsFile;
- $CountWorkflowsInProgress++
- }
- else
- {
- $list.ParentWeb.URL + "," + $list.ParentWeb.ID + "," + $list.Title + "," + $workflow.ItemName + "," + $workflow.ItemGUID + "," + $workflow.InstanceId | Out-File -Encoding Default -Append -FilePath $OtherWorkflows;
- $CountWorkflowsOther++
- }
- }
- }
- }
- " WorkFlows:"+ $CountWorkflows
- $CountWorkflowsTotal = $CountWorkflowsTotal+$CountWorkflows
- " WorkFlows InProgress:" + $CountWorkflowsInProgress
- $CountWorkflowsInProgressTotal = $CountWorkflowsInProgressTotal+ $CountWorkflowsInProgress
- " WorkFlows Other States:" + $CountWorkflowsOther
- $CountWorkflowsOtherTotal = $CountWorkflowsOtherTotal + $CountWorkflowsOther
- $_.url + "," + $_.ID + "," + $_.ParentWebID + "," + $_.Site.ID + "," + $_.LastItemModifiedDate + "," + $_.WebTemplate + "," + $_.WebTemplateID + "," + $_.HasUniquePerm + "," + $Size + "," + "`"$SiteAdmins`"" + "," + "`"$FullControl`"" + "," + $CountWorkflows + "," + $CountWorkflowsInProgress + "," + $CountWorkflowsOther| Out-File -Encoding Default -Append -FilePath $SitesFile;
-
- }
- "Total Workflows:" + $CountWorkflowsTotal
- "Total Workflows In Progress:" + $CountWorkflowsInProgressTotal
- "Total Workflows In Other States:" + $CountWorkflowsOtherTotal
- Give Site Collection Admin permission to the user id in both the source and destination site collections.
- Check the features in both the source and destination, and activate whichever ones are not yet activated in the destination site collection.
- Run as administrator on the ShareGate tool and launch Migration.
- Connect the source destination with valid authentication.
- Run the Pre-Check report to solve errors and warnings in bulk.
- Map the Unresolved Users and Groups to an SPFarmAdmin id to avoid users not found errors /warnings, as shown below in the screenshot.
- Similarly, do the necessary Site Template mappings.
- Similarly, do the necessary Permissions mappings.
- Select the top site if sub sites are also available for migration, as ShareGate automatically selects all of them to migrate.
- Start migration with the below settings.
- You can also generate the report and start validating to solve the errors /warnings.
- 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.