Office 365 DirSync users getting domainname.onmicrosoft.com addresses as default

You setup Office 365 DirSync and the default domain for the users is domainname.onmicrosoft.com instead of your default defined domain in Office 365. It will not allow even the Office 365 administrator change the email addresses of individual users from the Office 365 console. The reason is with AD synchronization enabled by default it uses the proxy address field of the user sent from AD. If that is blank in AD it will use domainname.onmicrosoft.com.

You can either use ADSIedit to modify the proxy address fields individually for each user or you can use a powershell script and csv file such as the one below to do so in bulk.

Word of warning it will overwrite any existing proxyaddresses not just SMTP: (primary) it will also remove smtp: (aliases) if you run it as is.

Additionally if your “user logon name” does not match your “user logon name (Pre-Windows 2000)” it will fail on those.

Create an excel file with the following fields and export to a csv called c:\mailboxlist.csv

name ProxyAddress
kevin.oppihle SMTP:kevin.oppihle@domainname.com

Create a .txt file and input the following

$users=import-csv C:\mailboxlist.csv
foreach($user in $users){
$u = Get-ADUser $user.name -Properties mail,department,ProxyAddresses
$u.ProxyAddresses = $user.ProxyAddress 
Set-ADUser -instance $u
}

Save the file as proxyemail.ps1

Open powershell as an administrator on you local AD server and run

 ./proxyemail.ps1

You can then use ADSIedit to confirm the proxy addresses were assigned to the users.

With the next DirSync process the updates should push to Office 365

Credit References:

Daryl Hunter, DuRand Bryant

Comments

Popular posts from this blog

FRS to DFSR Post Cleanup “File Replication NtFrs Stopped”

Domain Migration SubinACL /Migratetodomain How To:

How to configure HP LaserJet Printer IPsec Encryption