Solved

Add Additional Aliases for one mailbox via CSV import

Posted on 2014-10-08
12
624 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
Make managing Office 365 email signatures a breeze

Are you using Office 365? Having trouble trying to set up email signatures for your users? Getting stressed out managing multiple signatures? Need an easier way to manage? We have a solution for you, try the most-user friendly and powerful signature management tool on the market.

 
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

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
To show how to generate a certificate request 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 Servers >> Certificates…
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…

932 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

9 Experts available now in Live!

Get 1:1 Help Now