-
-
Save irwins/389ef8819fa1ee32f694786c39123732 to your computer and use it in GitHub Desktop.
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
$csvUrls = Import-Csv C:\scripts\sources\csv\VerifyUrls.csv -Delimiter "`t" -Encoding UTF8 | |
#region Initialize Stuff | |
Import-Module ShareGate -Verbose:$false | |
# User account for an Office 365 global admin in your organization | |
# https://www.jaapbrasser.com/quickly-and-securely-storing-your-credentials-powershell/ | |
$HashCreds = Import-CliXml -Path "${env:\userprofile}\Hash.Cred" | |
#Admin urls | |
$targetAdminUrl = 'https://urv-admin.sharepoint.com' | |
$sourceAdminUrl = 'https://irwins-admin.sharepoint.com' | |
#Connect to Tenant Site | |
$targetTenantSite = Connect-Site -Url $targetAdminUrl -Credential $HashCreds.'urv-target-o365admin' | |
$sourceTenantSite = Connect-Site -Url $sourceAdminUrl -Credential $HashCreds.'irwins-source-o365admin' | |
Function Get-ODFBUrls{ | |
param($sourceUserEmail,$targetUserEmail) | |
#Provision using Sharegate and wait for it to finish. | |
$targetOneDriveUrl = Get-OneDriveUrl -Tenant $targetTenantSite -Email $targetUserEmail | |
$sourceOneDriveUrl = Get-OneDriveUrl -Tenant $sourceTenantSite -Email $sourceUserEmail | |
[PSCustomObject]@{ | |
SourceEmail = $sourceUserEmail | |
SourceODFBUrl = $sourceOneDriveUrl | |
TargetEmail = $targetUserEmail | |
TargetODFBUrl = $targetOneDriveUrl | |
} | |
} | |
#region Get ODFB Urls | |
$csvUrls | | |
ForEach-Object{ | |
Get-ODFBUrls -sourceUserEmail $_.SourceEmail -targetUserEmail $_.TargetEmail | |
}| | |
Export-Csv C:\scripts\export\ODFBUrls-27112017.csv -Encoding UTF8 -Delimiter "`t" -NoTypeInformation | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment