Solved

Add Additional Aliases for one mailbox via CSV import

Posted on 2014-10-08
12
596 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
  • 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
 

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

Join & Write a Comment

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
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 >>…
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

746 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

10 Experts available now in Live!

Get 1:1 Help Now