Solved

Need a script for adding Proxy email address @domain.onmicrosoft.com for group of users

Posted on 2013-11-20
2
763 Views
Last Modified: 2013-11-21
Need a script for adding Proxy email address @domain.onmicrosoft.com for group of users.
Please help. Would be great if it can read excel file and then make sure that if the address domain.onmicroft.com is not there, then add it.

THank you very much.
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 19

Accepted Solution

by:
suriyaehnop earned 500 total points
ID: 39663937
Try this:

$Users = Import-Csv C:\PS\Users.csv

Foreach ($User in $Users){

   $ProxyAddresses = (Get-Mailbox $user.alias).emailaddresses
   Foreach ($address in $ProxyAddresses) {
        If (($Address.PrefixString -eq "smtp") -and ($address.AddressString.split("@")[1] `
        -eq "contoso.com")) {
              $ProxyAddresses += $Address
        }
   }
   Set-Mailbox $user.alias -EmailAddresses $ProxyAddresses -EmailAddressPolicyEnabled:$false
   Set-Mailbox $user.alias -EmailAddressPolicyEnabled:$false
}
}

Open in new window

0
 

Author Closing Comment

by:claudiamcse
ID: 39666775
Great! Thank you
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
how to add IIS SMTP to handle application/Scanner relays into office 365.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

730 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