Hi,
You can use powershell Az module to create a powershell script.
Get-AzADUser will give you all users in a particular tenant and then you can compare in whatever way you want.
Hope this helps
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
My work has purchased another business that has an Office 365 tenant. I want to migrate those user and groups etc over to our current Office 365 tenant. Before doing that I need to compare UPN, email addresses etc for conflicts. For example, we would currently have an accounting@business1.com and the other tenant may have accounting@business2.com
When bringing that over I will need to rename the one we are migrating from to example usa.accounting@business1.com
Is there a way to easily compare these for conflicts before hand? We have thousands and thousands of groups so I can't go through manually and check off that many groups and names. I think I would be there forever.
Does anyone know an easy way to do this? Is there a program out there or something else that could help?
Appreciate your responses.
Hi,
You can use powershell Az module to create a powershell script.
Get-AzADUser will give you all users in a particular tenant and then you can compare in whatever way you want.
Hope this helps
Connect to the purchased tenant, run commands below on it(Those two files will be used to compare on the new tenant):
Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize unlimited | select PrimarySmtpAddress | Export-Csv c:/temp/users.csv -NoTypeInformation
Get-DistributionGroup -ResultSize unlimited | select PrimarySmtpAddress | Export-Csv c:/temp/groups.csv -NoTypeInformation
Connect to new tenant, then run script below on it(Save script blow into a .PS1 file):
Compare mailboxes:
$users = Import-Csv c:/temp/users.csv
foreach ($user in $users){
$temp = $user.PrimarySmtpAddress.Split('@')[0]
If(Get-Mailbox $temp -erroraction 'silentlycontinue'){
Write-Host $temp "exist in this tenant"
}
}
Compare groups:
$users = Import-Csv c:/temp/Groups.csv
foreach ($user in $users){
$temp = $user.PrimarySmtpAddress.Split('@')[0]
If(Get-DistributionGroup $temp -erroraction 'silentlycontinue'){
Write-Host $temp "exist in this tenant"
}
}
If there exist a mailbox or group using the same prefix for email address, you will get a result like below:
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.