# Additional Alias'

**URL:** <https://forums.powershell.org/t/additional-alias/7643>\
**Category:** PowerShell Help\
**Created:** [December 5, 2016, 7:49am UTC](https://forums.powershell.org/t/additional-alias/7643 "2016-12-05T07:49:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bootsmazza](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bootsmazza](https://forums.powershell.org/u/bootsmazza)\
**Post date:** [December 5, 2016, 7:49am UTC](https://forums.powershell.org/t/additional-alias/7643/1 "2016-12-05T07:49:40Z")

</div>

Hi there,

I have an additional alias to add to 100’s of user accounts in O365. I was hoping to add these to a .csv file and use powershell to add these.

I don’t require these to be primary addresses but just to act as an additional address.

Does anyone know the command to put into Powershell at all? I was provided with one:

$csv = import-csv file.csv  
foreach($users in $csv)  
{  
set-mailbox $emailaddress -emailaddresses @{add=“$secondaryemailaddress”}  
}

When I run this it displays the error message

Cannot process argument transformation on parameter ‘EmailAddresses’. Cannot convert value “System.Collections.Hashtable” to type “Microsoft.Exchange.Data.ProxyAddressCollection”.

---

<div class="post-metadata">

**Author:** ![matt-mcnabb](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@matt-mcnabb](https://forums.powershell.org/u/matt-mcnabb)\
**Post date:** [December 5, 2016, 8:02am UTC](https://forums.powershell.org/t/additional-alias/7643/2 "2016-12-05T08:02:59Z")

</div>

What are the values of $EmailAddress and $SecondaryEmailAddress, and where are you populating them? If the only code you’re running is what’s in the example above, then these values will be null.

---

<div class="post-metadata">

**Author:** ![skalizar](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@skalizar](https://forums.powershell.org/u/skalizar)\
**Post date:** [December 5, 2016, 10:21am UTC](https://forums.powershell.org/t/additional-alias/7643/3 "2016-12-05T10:21:13Z")

</div>

Need to see the headers of your csv file. I expect it needs to be something like:

set-mailbox $users.emailaddress -emailaddresses @{add=“$($users.secondaryemailaddress)”}

Also, don’t run this or anything else on your whole list as a test. Edit your csv file to just one user, that way, you only have 1 user to fix if it makes a mess.

---

<div class="post-metadata">

**Author:** ![bootsmazza](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bootsmazza](https://forums.powershell.org/u/bootsmazza)\
**Post date:** [December 6, 2016, 3:22am UTC](https://forums.powershell.org/t/additional-alias/7643/4 "2016-12-06T03:22:26Z")

</div>

Hi Matt & Ron,

Apologies if my first post wasn’t the best. Fairly new to Powershell so slowly getting to grips with it all.

Thankfully I am only testing this on one user so that I don’t mess up the entire tenant! I basically have a spreadsheet with 3 columns titled:

users - the contains the users full name  
emailaddress - this contains the users primary smtp address  
secondaryemailaddress - this contains the email address that I would like to add as an additional alias.

Not sure if this is what you’re after but please let me know if not.

---

<div class="post-metadata">

**Author:** ![skalizar](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@skalizar](https://forums.powershell.org/u/skalizar)\
**Post date:** [December 6, 2016, 9:15am UTC](https://forums.powershell.org/t/additional-alias/7643/5 "2016-12-06T09:15:05Z")

</div>

I guessed right then, try substituting my line for set-mailbox and see if it works. Just make a note of what’s currently there so you can fix it.

---

<div class="post-metadata">

**Author:** ![max-kozlov](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@max-kozlov](https://forums.powershell.org/u/max-kozlov)\
**Post date:** [December 7, 2016, 2:52am UTC](https://forums.powershell.org/t/additional-alias/7643/6 "2016-12-07T02:52:30Z")

</div>

Ron, why you suggect use `@{add=“$($users.secondaryemailaddress)”}`  
instead of `@{ add = $users.secondaryemailaddress }` ?  
It will spread over internet and get rise to dozens of new wuestions 🙂

---

<div class="post-metadata">

**Author:** ![bootsmazza](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@bootsmazza](https://forums.powershell.org/u/bootsmazza)\
**Post date:** [December 7, 2016, 5:47am UTC](https://forums.powershell.org/t/additional-alias/7643/7 "2016-12-07T05:47:03Z")

</div>

Hi All,

Thanks for your replies.

I managed to get this working in the end using the following:

Import-CSV “.\MultipleAlias.csv” | ForEach {Set-Mailbox $_.Mailbox -EmailAddresses @{add=$_.NewEmailAddress}}

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:39pm UTC](https://forums.powershell.org/t/additional-alias/7643/8 "2024-05-16T20:39:48Z")

</div>

Closed on May 16, 2024, 8:39pm UTC


