Solved

add multiple secondary addresses to exchange accounts

Posted on 2013-12-20
5
312 Views
Last Modified: 2013-12-20
I have a list of user accounts that need secondary acounts from an exchange list.



user1  user1@somecompany.com
user2  user2@contoso.local
user3  user4@yahoo.com

I was going to try somthing like this but it does not work pleae help

import-csv c:\temp\addusers.csv | foreach-object {set-mailbox $_ -emailaddress
0
Comment
Question by:techdrive
  • 2
  • 2
5 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 39732373
Import-Csv c:\temp\addusers.csv | Foreach-Object{
$user = Get-Mailbox -Identity $_.LoginName
$user.EmailAddresses+=$_.SecondaryAddress
Set-Mailbox $user -EmailAddresses $user.EmailAddresses
}

This is based on the idea of creating the csv with Login Name and secondary email in the csv.
0
 

Author Comment

by:techdrive
ID: 39732407
this is going through the entire directory. I do not think this is correct
0
 
LVL 29

Expert Comment

by:becraig
ID: 39732432
I assume you are talking about the line:
$user = Get-Mailbox -Identity $_.LoginName

Which simply identifies the user mailbox that matches the value from your csv LoginName.

I am not sure how you would want to update the user without validating from the directory that the mailbox you want to update exists in the directory  ?

I would suspect in order to update the mailbox you would need to identify the user to update which is what this line does.
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39732455
Try..
Import-CSV C:\temp\users.CSV | % {
Set-Mailbox $_.UserName -EmailAddresses @{add=$_.Email}
}

Open in new window

Sample Csv file..
UserName,Email
user1,user1@somecompany.com
user2,user2@contoso.local
user3,user4@yahoo.com

Open in new window

0
 

Author Comment

by:techdrive
ID: 39732499
Subsun many many thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦

733 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