?
Solved

Add Additional Aliases for one mailbox via CSV import

Posted on 2014-10-08
12
Medium Priority
?
756 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
Four New Appliances. Same Industry-leading Speeds.

But don't take it from us.  The Firebox M370 is Miercom tested and Miercom approved, outperforming its competitors for stateless and stateful traffic throughput scenarios.  Learn more about the M370, M470, M570 and M670 and find the right solution for your organization today!

 

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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Suggested Courses
Course of the Month12 days, 6 hours left to enroll

752 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