Solved

Create Alias in Office 365

Posted on 2016-10-04
7
23 Views
Last Modified: 2016-10-26
Hello Experts,
I have few requirements:
1. I have Primary emails created in O365: user@abc.com
2. I want to export the list of all users in O365 with their Email addresses.
3. I want to create Alias's for all the user, which will be more than 1 e.g. user.name@abc.com & user@xyz.com & user.name@xyz.com
 In the above step there is a different Domain name also, i have the accepted domain already staged.
4. Also, I want to delete the .onmicrosoft.com for all users (if possible)

I would prefer if I can export the existing users in csv, then update different columns with Alias's & then update via powershell calling updated csv.

Thanks a lot in advance for your kind help.
Regards,
A
0
Comment
Question by:Ackles
  • 5
  • 2
7 Comments
 
LVL 39

Expert Comment

by:Vasil Michev (MVP)
ID: 41827814
You can append/delete to/from the list of aliases easily, for example:

Set-Mailbox user -EmailAddresses @{add="new@domain.com"}

Open in new window


The above cmdlet will add new@domain.com as alias for user's mailbox, while preserving all the existing ones. So there should be no need to mess with CSVs.

Same goes for the default onmicrosoft address. I'd recommend against removing it, but if you really want to do it you can use the same format with the "remove=" operator.

This will only work if you have the users provisioned directly in the cloud though, if you are using dirsync the changes need to be made on-prem.
0
 
LVL 11

Author Comment

by:Ackles
ID: 41827821
Thanks
But as you see in my example i have other criteria also
Example the user name is John@abc.com
Alias
Jj@ abccom
Jj@xyz.com
John@xyz.com

How would it be possible with this script?
0
 
LVL 39

Expert Comment

by:Vasil Michev (MVP)
ID: 41827848
You can add multiple aliases using the same method, and you can easily build new ones based on user's attributes. For example, this will add an alias based on the user's first and last name:

Get-user user | % { Set-Mailbox $_.Identity -EmailAddresses @{add=$($_.FirstName + "." + $_.LastName + "@domain.com")} }

Open in new window


If you remove the actual user, the above example can also be run against the full list (or a subset) of users, and will add the firstname.lastname@domain.com alias for all of them. Which for me is way better method than doing it manually via CSV.
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 11

Author Comment

by:Ackles
ID: 41827865
Thanks Vasil,
Let me try to explain again....
As for the first & last name it's fine, but we have some special internal names (as illustrated in earlier example "jj@abc.com & jj@xyz.com"
Because of this the above listed script won't suffice the need.

So that's why I was looking for csv method.....
0
 
LVL 11

Author Comment

by:Ackles
ID: 41827966
I found this script on o365info.com
$Users = Import-CSV C:\TEMP\book1.csv $Users | ForEach {Set-Mailbox $_.UserID -EmailAddresses $_.NewAddress,$_.UserID,$_.Proxy1}

They also provide a CSV, however the issue is that it's not working for the exiting users...
Screen-Shot-2016-10-04-at-14.54.50.png
0
 
LVL 11

Accepted Solution

by:
Ackles earned 0 total points
ID: 41827972
Got it!!!
This is what i did:

1: $Users = Import-CSV C:\TEMP\book1.csv
2. $Users | ForEach {Set-Mailbox $_.UserID -EmailAddresses @{add = $_.UserID,$_.Proxy1,,$_.Proxy2,,$_.Proxy3}}

& it worked!!!
0
 
LVL 11

Author Closing Comment

by:Ackles
ID: 41859957
Worked as desired
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
Read this checklist to learn more about the 15 things you should never include in an email signature.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
how to add IIS SMTP to handle application/Scanner relays into office 365.

808 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