Solved

Create Alias in Office 365

Posted on 2016-10-04
7
44 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
[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
  • 5
  • 2
7 Comments
 
LVL 41

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 41

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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

717 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