Solved

Add Additional Aliases for one mailbox via CSV import

Posted on 2014-10-08
12
729 Views
Last Modified: 2014-10-20
Hello,

I have an account called 'websitepayments' I need to add loads of additional alias' to this mailbox only, I've attached an excel document, how would I go about this?

Thanks in advance!
MobilePaymentSMTPList.xlsx
0
Comment
Question by:ProjNet
[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
  • 7
  • 5
12 Comments
 
LVL 19

Expert Comment

by:Miguel Angel Perez Muñoz
ID: 40368122
This account has any alias now?
0
 

Author Comment

by:ProjNet
ID: 40368140
Hi Miquel,

Yes it has, but none of the alias that are in the document.

Thanks
0
 
LVL 19

Expert Comment

by:Miguel Angel Perez Muñoz
ID: 40368159
Ok, I know one way maybe someone would get you some more elegant (one command):
First run:
Get-Mailbox websitepayments | select emailaddresses
This gives you all smtp address this mailbox, copy to a text file on a email per line, only email, no smtp or whatever.
Then, on this txt file, add all smpt address included on your excel.
Must be one email per line.
The last command:
Set-Mailbox websitepayment -EmailAddresses (get-content file_with_emails.txt)
Read all emails on file and replace all email address of websitepayment with readed email on file.

I suggest you check first on another test account.
0
Independent Software Vendors: 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!

 

Author Comment

by:ProjNet
ID: 40377460
Hello,

I tried your command but the shell cuts off the addresses? like so:


EmailAddresses                                                                
--------------                                                                
{SMTP:website.payments@wyevalegardencentres.co.uk, smtp:Website.Payments@the...
0
 
LVL 19

Expert Comment

by:Miguel Angel Perez Muñoz
ID: 40379267
Yes you must do some changes, maybe do a redirect to txt file:
Get-Mailbox websitepayments | select emailaddresses |  out-file C:\file.txt
Edit this txt to remove all "smtp:" and whatever not an email address (very easy with search and replace) and add to this file all email address you want to add. Then run Set-Mailbox websitepayment -EmailAddresses (get-content file_with_emails.txt)
0
 

Author Comment

by:ProjNet
ID: 40379435
Hi Miguel,

Tried the above didn't quite work out for me, I also tried this command:

Import-CSV "c:\documents and settings\adurrant\desktop\addemailaddresses.csv" | Set-Mailbox -Identity WebsitePayments -EmailAddresses @{add=$_.NewEmailAddress}}

I moved all of the email addresses into one column, I got this error:


[PS] C:\Documents and Settings\adurrant>Import-CSV "c:\documents and settings\adurrant\desktop\addemailaddresses.csv" |
Set-Mailbox -Identity WebsitePayments -EmailAddresses @{add=$_.NewEmailAddress}
Set-Mailbox : Cannot bind parameter 'EmailAddresses'. Cannot convert the "System.Collections.Hashtable" value of type "
System.Collections.Hashtable" to type "Microsoft.Exchange.Data.ProxyAddress".
At line:1 char:134
+ Import-CSV "c:\documents and settings\adurrant\desktop\addemailaddresses.csv" | Set-Mailbox -Identity WebsitePayments
 -EmailAddresses <<<<  @{add=$_.NewEmailAddress}
    + CategoryInfo          : InvalidArgument: (:) [Set-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchange.Management.RecipientTasks.SetMailbox


Any ideas?
0
 
LVL 19

Expert Comment

by:Miguel Angel Perez Muñoz
ID: 40379448
This is caused by datatype. Could you paste result of:
Import-CSV "c:\documents and settings\adurrant\desktop\addemailaddresses.csv" |gm

Thanks.
0
 

Author Comment

by:ProjNet
ID: 40379827
Hello,

Results:

[PS] C:\Documents and Settings\adurrant>Import-CSV "c:\documents and settings\adurrant\desktop\addemailaddresses.csv" |g
m


   TypeName: System.Management.Automation.PSCustomObject

Name            MemberType   Definition
----            ----------   ----------
Equals          Method       bool Equals(System.Object obj)
GetHashCode     Method       int GetHashCode()
GetType         Method       type GetType()
ToString        Method       string ToString()
NewEmailAddress NoteProperty System.String NewEmailAddress=MobilePayment.175@wgcl.co.uk
0
 
LVL 19

Expert Comment

by:Miguel Angel Perez Muñoz
ID: 40379845
Try this:
Set-Mailbox -Identity WebsitePayments -EmailAddresses @{add=import-csv "c:\documents and settings\adurrant\desktop\addemailaddresses.csv"}}

But txt command must work.
0
 

Author Comment

by:ProjNet
ID: 40380045
Thanks again,

still errored:

[PS] C:\Documents and Settings\adurrant>Set-Mailbox -Identity WebsitePayments -EmailAddresses @{add=import-csv "c:\docum
ents and settings\adurrant\desktop\addemailaddresses.csv"}}
Unexpected token '}' in expression or statement.
At line:1 char:140
+ Set-Mailbox -Identity WebsitePayments -EmailAddresses @{add=import-csv "c:\documents and settings\adurrant\desktop\ad
demailaddresses.csv"}} <<<<
    + CategoryInfo          : ParserError: (}:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

[PS] C:\Documents and Settings\adurrant>Set-Mailbox -Identity WebsitePayments -EmailAddresses @{add=import-csv "c:\docum
ents and settings\adurrant\desktop\addemailaddresses.csv"}
Set-Mailbox : Cannot bind parameter 'EmailAddresses'. Cannot convert the "System.Collections.Hashtable" value of type "
System.Collections.Hashtable" to type "Microsoft.Exchange.Data.ProxyAddress".
At line:1 char:54
+ Set-Mailbox -Identity WebsitePayments -EmailAddresses <<<<  @{add=import-csv "c:\documents and settings\adurrant\desk
top\addemailaddresses.csv"}
    + CategoryInfo          : InvalidArgument: (:) [Set-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
0
 

Accepted Solution

by:
ProjNet earned 0 total points
ID: 40382049
I managed to do this via ADDS module instead, example:

set-aduser websitepayments -Add @{proxyAddresses="smtp:MobilePayment.175@wgcl.co.uk"}
0
 

Author Closing Comment

by:ProjNet
ID: 40391537
worked it out myself, thanks to miquel though :)
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

707 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