Forum Discussion
Migrate mailbox to another domain same Tenant
gteibo1Hi there!
Your description is a bit vague, lets see if i understood you correctly:
A)
You have a tenat X and you are NOT going to setup a new tenant but just register a DOMAIN in the existing tenant x and want to change the UPN so that the users receive mail with the new Domain name?
OR
B)
You want to physically move mailboxes between Tenants?
Two totally different things here, let me know what you actually want to achieve and am happy to help. Done some 300+ migrations so might be able to help you 🙂
EvilSecurityFellow
- parsian2Jul 04, 2024Copper ContributorEvilSecurityFellow
A)
You have a tenat X and you are NOT going to setup a new tenant but just register a DOMAIN in the existing tenant x and want to change the UPN so that the users receive mail with the new Domain name?
exactly i want to do as you mentioned on point (A)- chrisslrothJul 04, 2024Brass ContributorHi gteibo1,
Change the UPN with Powershell:
# Define the new UPN suffix
$newUPNSuffix = "new-domain.com"
# Connect to Azure AD
Connect-AzureAD
# Get all users in Azure AD
$users = Get-AzureADUser -All $true
# Loop through each user and update their UPN
foreach ($user in $users) {
# Extract the username part from the current UPN
$username = ($user.UserPrincipalName).Split('@')[0]
# Construct the new UPN
$newUPN = "$username@$newUPNSuffix"
# Set the new UPN
Set-AzureADUser -ObjectId $user.ObjectId -UserPrincipalName $newUPN
}
Write-Host "UPNs have been updated for all users."
After hat change der primary SMTP address:
# Define the new primary SMTP domain
$newPrimarySMTPDomain = "newdomain.com"
# Get all mailboxes
$mailboxes = Get-Mailbox -ResultSize Unlimited
# Loop through each mailbox and update the primary SMTP address
foreach ($mailbox in $mailboxes) {
$currentPrimarySMTP = $mailbox.PrimarySmtpAddress
$newPrimarySMTP = $mailbox.UserPrincipalName.Replace('@', "@$newPrimarySMTPDomain")
# Set the new primary SMTP address
Set-Mailbox -Identity $mailbox.Identity -PrimarySmtpAddress $newPrimarySMTP -EmailAddressPolicyEnabled $false
Write-Host "Changed primary SMTP address for $($mailbox.DisplayName) from $currentPrimarySMTP to $newPrimarySMTP"
}
Write-Host "Primary SMTP addresses have been updated for all mailboxes."
- John1982Oct 05, 2020Copper Contributor
Hi we are also doing a migration from one Office 365 tenant to another in batches. the UPN is changing because they use mailto:firstname.lastname@domain.com
Source was mailto:firstinitial.lastname@domain.com
I have a question about Resource Room Mailboxes. Has anyone dealt with that.
Like how to handle Meeting Rooms when you migrating from Office 365 to Office 365 and your domain and upn are changing actually
Thanks
- Oct 06, 2020Mover.Io is an amazing tool for quick migrations