Jun 30 2020 04:20 AM
hi guys,
The tenacy I manage has a lot of users. They have just bought a new domain name and want to assign a new primary address to everyone whilst keeping their exisiting address as an alias so not to miss future mails.
I know this can be done in the GUI now by batch selecting users and clicking change domain but this will base the new address on their current username and they might want to change the format of the new one.
I've looked at how to do this in powershell using a script to pull data from a csv where one column has existing address and another column with the new one. I've ran a test and it seems to of worked as expected but just wanted to check with you guys if these seem like the right commands so that there isn't a knock on effect i'm not aware of:
Import-Csv 'C:temp\filelocation.csv' | ForEach-Object {
Set-Mailbox $_."UserPrincipalName" -WindowsEmailAddress $_."NewEmailAddress" -MicrosoftOnlineServicesID $_."NewEmailAddress"
}
The only thing I noticed is a warning that appeared but apparently it can be ignored?
WARNING: UserPrincipalName "emailaddress" should be same as WindowsLiveID "emailaddress", UserPrincipalName should remain as"emailaddress".
Thanks!
Jun 30 2020 04:38 AM
Jun 30 2020 08:59 AM
Changing the UPN value via PowerShell does not automatically result in changing the Primary SMTP address, unlike performing the same operation via the UI. Thus you need to change the SMTP address manually, and the code you have above should work just fine.
Jul 02 2020 03:37 AM
@Vasil Michevthanks for confirming that the script i'm using should be ok