Link to home
Start Free TrialLog in
Avatar of lighthousekeeper
lighthousekeeper

asked on

Office 365 remove SMTP address off all accounts in bulk (800 accounts)

We have an Office 365 tenant which has multiple verified domains and those domains are assigned to the mailboxes.  We need to remove one of the domains from the portal.  The accounts which are assigned the domain that we want to remove only have this domain assigned to their mailbox and the .onmicrosoft.com domain as well.  We want all the accounts to be left with only the .onmicrosoft.com domain as the sign in ID and the primary SMTP address.

We will need to:

1- Change the user's sign in ID to .onmicrosoft.com.
2- Change the user's primary SMTP address to .onmicrosoft.com.
3- Remove the verified domain from the user's mailboxes without affecting the other accounts and their sign-in IDs and other validated SMTP addresses.

I have #1 down:  Get-Msoluser -DomainName "MyValidatedDomain.com" |%{Set-MsolUserPrincipalName -UserPrincipalName $_.UserPrincipalName -NewUserPrincipalName ($_.userprincipalname.split("@")[0]+"@MyMSDomain.onmicrosoft.com");Write-Host "UPN Has been updated for" $_.DisplayName}

Could someone help with #2 and #3?  Remember, we can't affect the other accounts with other verified SMTP domains, just the ones with the SMTP domain that we want to remove.

Thanks,

Julian
ASKER CERTIFIED SOLUTION
Avatar of Vasil Michev (MVP)
Vasil Michev (MVP)
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial