Solved

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

Posted on 2013-11-20
2
740 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
Comment Utility
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
Comment Utility
Great! Thank you
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Easy CSR creation in Exchange 2007,2010 and 2013
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this video we show how to create a Distribution Group 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 >>…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now