ExchangeNerd

Powered by Ed Buford and Coffee

Archives: April 2015

Office 365 has wrong email address Part 2

In the post:  Office 365 has wrong email address Part 1 I covered the issue of not being able to set the Email Address of a user who is being managed by Active Directory On-Prem. If you  doesn’t have a Hybrid Exchange server to set email attributes you will need to do that manually.  If any of this confuses you please jump back to Part 1 and make sure you get

what’s happening.

There are a number of scenarios of what you’re going to see when you dig into the ProxyAddresses attribute of a user. You may see an X.500 record, you may see something like the UPN that you don’t want to have. For my test domain it would like like this highlighted address:

2015-04-05_08h59_29

You can see by the way it is being formatted the address is the users UPN (User Principle Name) as it includes the full domain suffix: Corp.ExchangeNerd.com
Now I really don’t want to get too deep into the UPN but if you find you need it to get going you can leave a comment and I’ll try to answer it for you.

Getting back to the issue at hand how to change Primary Email Address of the a bunch of users at one time.  Leaving behind UPN and Domain Suffixes I’m just going to Add Primary Email addresses and figure the rest out later. In order to do that for my users I built a CSV file that has two columns The SAM Account Name and the Email Address I want my users to have.  I called this file HerosProxyAddress.csv and placed it in a folder called source on the C:\ drive.  Here’s a screen shot of what my CSV file looks like,

2015-04-05_09h12_52

Using these two columns I am able to create a quick PowerShell script to add the email address of each of the users.

Import-module ActiveDirectory $Users = Import-Csv -Path "C:\source\HerosProxyAddress.csv" foreach ($User in $Users) { $ProxyAddress = "SMTP:" + $user.'EmailAddress' Set-ADUser -identity $User.'sAMAccountName' -Add @{ProxyAddresses = $ProxyAddress} }

Copy this code into Notepad and save it with a .ps1 extension.  I saved mine as ChangeProxyAddress.ps1

Now on the domain controller I opened PowerShell as the Administrator and navigate to the place where I saved my PowerShell script.  Then  type:  .\ChangeProxyAddress.ps1

Before you try this on a lot of users I’d encourage you to test this on a couple of test users to make certain it works correctly for you.

Once you change the user attributes in Active Directory you’ll need to go to your DirSync server and load the DirSync PowerShell module. Now run the Start-OnlineCoexistenceSync with the –FullSync to make sure you get the attributes pushed out to the Cloud.

There is a lot more to talk about on this topic and there are a couple other ways we could tackle this script and at least one more script to write to Solve adding one user at a time.
So be on the lookout for Part 3.

Office 365 has wrong email address Part 1

Lately this has come up a couple of times and I haven’t had too much time to set down and figure it out so today I thought I’d take the time to document the issues and a way to fix it.

When you set up DirSync from Active Directory to Office 365 without a hybrid Exchange server you’re faced with a problem: How do you set the Email address of the users?

When you use DirSync you can’t set the Office 365 email address out in the Cloud because it is being managed from Active DIrectory. If you don’t have a Hybrid Exchange configuration you don’t have any place to set the Email Address so when you go to Office 365 the email address will look like this: ebuford@ExchangeNerd.OnMicrosoft.com
So the question is how do I get rid of the OnMicrosoft.com part of the email address.

In order to answer the question above we have to understand that the problem comes from Active Directory not Office 365.  Since we’re using DirSync to send the Active Directory Attributes to Office 365 we need to have the Primary SMTP address set in AD. To Set the Primary SMTP address for a user in AD you need to edit ProxyAddresses Atrribute for the user AND you need to make sure the Primary Email address has the prefix of SMTP:
Just like you see it below.

2015-04-04_20h45_58

Now you can go about manually adding this address to each user in Active Directory but if you have a lot of users you’ll probably start hating life pretty quickly. So in Part 2 we’ll look at some code to Automate this process.

[Top]