office 365 add/remove secondary smtp account to user

i would like to add/remove secondary smtp account in office 365 but it si ad synch.

how i can do it from powershell?
Mark SoultchAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jian An LimSolutions ArchitectCommented:
Disclaimer: code was a copy paste from some other website so don't use it without think through what it is going to do.

The idea is the 2 field you need to change is mail attribute (if you want to change the primary domain) and proxyaddresses attribute (for multiple email address for a user)

I usually change this in attribute editor from ACtive Directory User Computer but you can do it via powershell below


you can use either via powershell stle ldap

               $aduser = get-aduser -identity xxxxxxx
                #    append value to proxyaddress array using ADSI Edit connector
                $user = [ADSI]"LDAP://$($aduser.distinguishedname)"
                $ads_property_append = 3
                $user.Putex($ads_property_append, "proxyaddresses",  @("smtp:$($aduser.emailaddress)"))
                $user.setinfo()

Open in new window


or via powershell

$user = Get-ADUser GlenJohn -Properties mail,department,ProxyAddresses
$user.ProxyAddresses = "glen@fabrikam.com"   ## or maybe use += to have multiple of proxyaddresses
Set-ADUser -instance $user 

Open in new window

0
Jian An LimSolutions ArchitectCommented:
Also remember (i know you will), since you add additional domain, you need to verify that domain on office 365 and change the MX record accordingly for the full solution to work
0
Mark SoultchAuthor Commented:
in active directory in which position you update the information for the user???
0
Jian An LimSolutions ArchitectCommented:
if you open in ADUC,
make sure you have Advanced Features ticked

then you can double click any users object (not through find windows though)
you should see attribute editor tab
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Office 365

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.