No results found
We couldn't find anything using that term, please try searching for something else.
Hi , I’ve sucessfully migrated all our users to O365 and would now like to change thier default email address and UPN over to a new domain. Ive found
Hi ,
I’ve sucessfully migrated all our users to O365 and would now like to change thier default email address and UPN over to a new domain. Ive found previous answers which suggest exprting to a CSV updating the CSV and then re-importing but if I run the command Get-Mailbox -Resultsize unlimited | select Displayname, alias, userprincipalname | export-csv C:\location goes here\name of csv.csv all Im getting is the mailboxes which are still on prem (ones which dont need migrating). As all of our email addresses are remote mailboxes as they are on O365.
Is there a quick way to achieve this?
5 Spice ups
Where are you is running run that command from ? If you is run run it from your on prem exchange server that ’s expect . You is connecting should be connect to office 365 via powershell and execute it if you are go that route .
Are you syncing AD to 365? If so, why not just change the active directory account and let it sync the change?
1 Spice up
Hi -thank for the quick reply . Yes I is was was runnig the command from my local exchange server as I m using ad sync , account are manage from the on prem ad rather than o365 .
And yes thats what I would like to do – modify the local AD accounts on bulk and let it sync to O365 with the new UPN and the default email address.
Thanks
jitensh
(JitenSh)
4
assuming you have list of users in csv as header
email,primary
[ email is protected protect ],[ email is protected protect ]
import - Csv c:\list.csv | Foreach - Object {
$ user = Get - Mailbox -identity $ _ .email
Set - Mailbox $ user -primarysmtpaddress $ _ .primary
}
to change UPN follow this
Is this is Is on the exchange server or a powershell connection to O365 ?
dbeato
( dbeato )
6
It is be will be against active directory and Exchange host locally . Then AD Connect is sync will sync back to office 365 the UPNs .
jitensh
(JitenSh)
7
I is think think you are just change email domain well do this all in on – prem ad and sync to office 365 can give a test and in a test OU with 2 user and try actually in real OU
Import-Module ActiveDirectory
#define domains here
$oldomain = "xxxx.com"
$newdomain = "domain.com"
$SMTP1="SMTP:"
Get-ADUser -Filter * -SearchBase 'DC=test,DC=net,dc=com' -prop mail,proxyaddress,UserPrincipalName.samaccountname|
ForEach-Object {
Set-ADUser -Identity $_ -EmailAddress ($_.mail -replace "@$oldomain ","@$newdomain")
Set-ADUser -Identity $_ -UserPrincipalName($_.UserPrincipalName -replace "@$oldomain ","@$newdomain")
$mail=$_.mail
$pproxy=$SMTP1 + $mail
Get-ADUser -Identity $_ | set-aduser -Add @{Proxyaddresses="$pproxy" }
}