So you have generated users in your ad that you want to move to Office 365.
Before you dirsync the user to the Cloud you can change mail-attribute.
But after the user in synced to Office365 you cannot do this anymore.
If you are too late you have to add or modify the ProxyAddresses and it will change the primary smtp-address in Office356 (SMTP is primary and smtp is secondary!)
** Edit 14.8.2017 – Wrong syntax in script **
First:
1 |
Get-ADUser -Filter {UserPrincipalName -like "*@currentdomain.fi"} -SearchBase "OU=therightOU,DC=contoso,DC=com" -Properties name,emailaddress | select name,emailaddress | Export-CSV -Path c:\dir\old_mail.csv –nti |
1 |
Import-CSV c:\dir\new_mail.csv | ForEach-Object {Set-ADUser $_.name -EmailAddress $_.Email} |