Solved

I need help with the script to set the specific email address as primary email address.

Posted on 2013-11-22
2
687 Views
Last Modified: 2013-11-25
Hello,
I am having a big issue. I ran this script and it was suppose to add just domain.onmicrosoft.com as additional email but somehow all users primary email addresses got changed to the one in the policy and now users email bownce.

So, please help me to write a new script that I can specify for each Organizational unit to set the email address as the primary and uncheck to apply automatic policy email option.



$users = get-mailbox
foreach ($a in $users) {$a.emailaddresses.Add("smtp:$($a.alias)@domain.onmicrosoft.com")}
$users | %{Set-Mailbox $_.Identity -EmailAddresses $_.EmailAddresses}
0
Comment
Question by:claudiamcse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
Mahesh earned 500 total points
ID: 39670975
Create a new E-mail Address Policies and apply to your users. After applying the E-mail address though E-mail Address Policy, the new SMTP address will be set to Default SMTP Address automatically. And the old STMP address will be the secondary SMTP address.

Run the following cmdlet on exchnage server to disable "Automatically update Email Addresses based on email address policy" for the mailbox users:
Get-mailbox| set-mailbox –emailAddressPolicyEnabled $false
Note: Get-mailbox command collects all your mailbox enabled users in your organization and set-mailbox disables the “Automatically update Email Addresses based on email address policy" option of these users.

Mahesh
0
 

Author Closing Comment

by:claudiamcse
ID: 39674740
Thank you.
0

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
how to add IIS SMTP to handle application/Scanner relays into office 365.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question