Link to home
Start Free TrialLog in
Avatar of Mark Soultch
Mark Soultch

asked on

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?
Avatar of Jian An Lim
Jian An Lim
Flag of Australia image

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

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
Avatar of Mark Soultch
Mark Soultch

ASKER

in active directory in which position you update the information for the user???
ASKER CERTIFIED SOLUTION
Avatar of Jian An Lim
Jian An Lim
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial