Jump to content

Recommended Posts

Posted

Hello all,

 

Using Powershell or some other method, how can I add a new email contact for all users within a domain or all users within a specified CSV file? Thank you.

Posted (edited)

Hi Micheal,

 

I am assuming by Mail Contact you mean an alternative SMTP Address for each user, if this is the case then the following should help you do what you require. although this does depend on your environment so here is my best shot without knowing what your environment is

 

Option 1 - This assumes you do not have a Directory Sync Server in your Organization:

 

In the CSV file you need to have 2 headers with the following UserPrincipalName, EmailAddresses and below this you will then have the respective UPNs and Email Addresses

 

and then you would use the following powershell command:

 

Import-CSV C:\UserProxies.CSV | ForEach {Set-Mailbox -identity $_.UserPrincipalName -EmailAddresses @{Add="$_.EmailAddresses"}

 

Option 2 - This assumes you do have a Directory Sync Server within your Organization

 

If you have an Exchange OnPremise Server then you would do this using the Email Address Policy as I am sure you are aware, If you don't then AD PowerShell is good to get this sorted. You use similar syntax and that will be as follows:

 

You would use the same CSV File as mentioned in Option 1 with the same headers

 

You would then use the following powershell command:

 

Import-CSV C:\UserList.CSV | ForEach {$user = Get-ADUser $_.UserPrincipalName -property proxyAddresses | $user.ProxyAddresses = @{Add=$_.EmailAddresses | Set-ADuser -Istance $user}}

 

That should do what you require,

 

Note: the above command assumes you have seperated each email address you are adding with comma's (but i think you are only adding 1 SMTP Address per user)

 

Note 2: Ensure that the Proxy Address you are adding is a verified domain within Office 365

 

I hope that helps, If you have any questions please do let me know.

 

Regards,

James.

Edited by EduTech

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...