Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Create proxy email address and set it as the primary email (bulk) - Office 365 - Powershell

$
0
0

(1) i would like to basically create a proxy email address for every user by taking their existing email and simply changing the domain. so for example, bob@whatever.com would have proxy bob@whatever2.com

(2) i would then like a separate step to basically change the primary email. so bob@whatever2.com becomes the primary.

i need to do this in powershell because there are a ton of users.

i found this for (1):

$users = Get-Mailbox
foreach ($a in $users) {$a.emailaddresses.Add("smtp:$($a.alias)@<new domain name>")}
$users | %{Set-Mailbox $_.Identity -EmailAddresses $_.EmailAddresses}

but it seemed a bit dated and i was unsure. 

*edit* ok that worked great actually, so how do i change the primary email address now?



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>