Solved

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

Posted on 2013-11-20
2
760 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
2 Comments
 
LVL 18

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In this video we show how to create an email address policy 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 Mail Flow…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

831 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