This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tenantsource = Connect-Site -Url "https://contoso-admin.sharepoint.com" -Browser | |
$tenantdest = Connect-Site -Url "https://tailspin-admin.sharepoint.com" -Browser | |
$UPNDomainSource = "contoso.onmicrosoft.com" | |
$UPNDomainDestination = "tailspin.onmicrosoft.com" | |
#List of users in the old tenant that are to be migrated. Header in CSV is UPN. | |
$users = import-csv 'C:\temp\UPN.csv' | |
$filepath = "C:\temp\CopyContentOneDrive.csv" | |
# Header for CSV file | |
"UPN,SourceSite,DestinationSite" >> $filepath | |
foreach($user in $users){ | |
$userOneDriveURLSource = @() | |
$userOneDriveURLSource = Get-OneDriveUrl -Tenant $tenantsource -Email $user.UPN | |
$userUPN = @() | |
$userUPN = ($User.upn).replace("$UPNDomainSource","$UPNDomainDestination") | |
$userOneDriveURLDestination = @() | |
$userOneDriveURLDestination = Get-OneDriveUrl -Tenant $tenantdest -Email $userUPN -ProvisionIfRequired -DoNotWaitForProvisioning | |
"$($user.upn),$userOneDriveURLSource,$userOneDriveURLDestination" >> $filepath | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment