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

Change of reply SMTP address for addresses that already exist - in bulk

$
0
0

Hi all,

I was redirected here after initially posting on http://community.office365.com/en-us/forums/148/p/186747/546133.aspx#546133

Questions asked there is as follows.  Any assistance appreciated:

"Hi,

Hope I can explain this well enough and detail what I'm trying to achieve.  I have a bunch of users created in O365 already and all have multiple addresses.  Basically I want to change the primary SMTP address without adjusting the UPN/login (i.e. I want to leave the login id as the default .onmicrosoft.com address but I want the reply/primary SMTP address set to another address that already exists as a secondary address for all users in the format alias@mydomain.com.

I know the PowerShell command to adjust one at a time, but I'm looking for a bulk option to process this change for everyone (and ideally ignore Admin if possible - but didn't want to complicate things at this stage).

This is the PS command to change it for a single user and works perfectly:

Set-Mailbox joebloggs -WindowsEmailAddress jbloggs@mydomain.com

And here is my very poor attempt at trying to get it working in bulk.  Main issue is that the alias and domain don't appear to append to each other and my syntax is clearly wrong.  Hoping someone could assist in the last bit of syntax to get this functioning correctly?

$Users = Get-Mailbox
forEach ($a in $users) {Set-Mailbox $_.Identity -WindowsEmailAddress $($a.alias) + '@mydomain.com'}

Thanks"



Viewing all articles
Browse latest Browse all 21975

Trending Articles



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