Forum Discussion
Add email alias to multiple O365 user accounts in bulk
So simply adapt the script to run against just the users in question, either by using filter or by feeding a CSV file to the script. Here's a simple example:
Import-CSV blabla.csv | % {Set-Mailbox $_.UserPrincipalName -WindowsEmailAddress $_.NewAddress }
where the blabla.csv file has a column UserPrincipalName to identify the users, and a column NewAddress to specify the new primary SMTP address.
- jasoncluteJun 14, 2023Copper Contributor
VasilMichev
I need to do this exact thing (cloud)... can you tell me how to add a new domain as an alias email to all the users??- rdgraspenAug 18, 2023Copper Contributor
Our email address are firstname . Lastname @ olddomain Here is how I updated all of our email addresses.
get-aduser -Filter * | select samaccountname | Export-csv adusers.csv
Edit adusers.csv - Remove service accounts, etc and all accounts that should not be changed. Save.
Copy final list and put it in a text file - adusers.txt
Copy adusers.txt to Powershell folder
$adusers = get-contect adusers.txt
check $adusers - This should reflect the final list created in the csv file.
$adusers | Get-ADUser | ForEach-Object { Set-ADUser -EmailAddress ($_.givenName + '.' + $_.surna me + '@newdomain') -Identity $_ }
Get-ADUser -Properties * -Filter * | select name,samaccountname,emailaddress to check the results.
- ZekeYeagerSep 24, 2021Copper ContributorHi Vasil,
Just wanted to check with you if it is possible to add domain2.com to all users/sharedmailbox/DL/secgroup and Teams that have only domain1.com our tenant has multidomain and we want to update domain1.com only.