|
# tenants |
|
$tenantOne = connect-site -Url https://tenantOne-admin.sharepoint.com -Browser |
|
$tenantTwo = connect-site -Url https://tenantTwo-admin.sharepoint.com -Browser |
|
|
|
# List of unique user names of users need to migrate |
|
$csvFile = "C:\OneDriveMirationUserEmailList.csv" |
|
$table = Import-Csv $csvFile -Delimiter ";" |
|
|
|
# ShareGate incrementatl copy config. This will be only usable if you are copying incrementally |
|
$copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate |
|
<# |
|
Other options: |
|
|
|
New-CopySettings [[-OnWarning] <OnWarningAction {Continue | Cancel}>] [[-OnError] <OnErrorAction {Skip | SkipAllVersions | Cancel}>] [[-OnSiteObjectExists] <OnSiteObjectExistsAction {Merge | Skip}>] [[-OnContentItemExists] <OnContentItemExistsAction {Overwrite | Skip | Rename | IncrementalUpdate}>] [[-VersionOrModerationComment] <String>] |
|
|
|
#> |
|
|
|
# user names |
|
$tenantTwoAdmin = "[email protected]" |
|
$tenantOneAdmin = "[email protected]" |
|
|
|
# Passwords |
|
$tenantOneAdminPswd = ConvertTo-SecureString "1eafawtrf" -AsPlainText -Force |
|
$tenantTwoAdminPswd = ConvertTo-SecureString "rhgtrehfd" -AsPlainText -Force |
|
|
|
|
|
foreach ($row in $table) |
|
{ |
|
# definitions |
|
$upn = $row.login |
|
$OneUPN = $upn + "@tenantOne.onmicrosoft.com" |
|
$TwoUPN = $upn + "@tenantTwo.onmicrosoft.com" |
|
|
|
# write to console |
|
$dateTime = Get-Date |
|
Write-Output "________________________________________________________________________________" |
|
Write-Output $dateTime |
|
Write-Output "________________________________________________________________________________" |
|
|
|
# getting Two user config |
|
$TwoPersonalSite = Get-OneDriveUrl -Tenant $tenantTwo -Email $TwoUPN |
|
Write-Output "Copying from : $TwoPersonalSite" |
|
|
|
# getting One user config |
|
$OnePersonalSite = Get-OneDriveUrl -Tenant $tenantOne -Email $OneUPN |
|
Write-Output "Copying to : $OnePersonalSite" |
|
|
|
# copy content config |
|
$site = Connect-Site -Url $TwoPersonalSite -Username $tenantTwoAdmin -Password $tenantTwoAdminPswd |
|
$dstlist = Get-List -Site $site.Site -Name "Documents" |
|
|
|
$site = Connect-Site -Url $OnePersonalSite -Username $tenantOneAdmin -Password $tenantOneAdminPswd |
|
$srclist = Get-List -Site $site.Site -Name "Documents" |
|
|
|
#region COPY |
|
|
|
# full copy - uncomment below if you are performing a full copy |
|
# Copy-Content -SourceList $srclist -DestinationList $dstlist |
|
|
|
# Incremental copy |
|
Copy-Content -SourceList $srcList -DestinationList $dstList -CopySettings $copysettings |
|
|
|
#endregion COPY |
|
|
|
} |
|
|
|
<# |
|
Got questions? Post your question on Twitter and dont forget to tag me with @meetKushan |
|
#> |