Powershell Script

hungrybeaver

Expert Member
Joined
Mar 17, 2010
Messages
2,094
Reaction score
3
Location
Durban
I'm not getting much feedback in the Software subforum, maybe you guys can help?


In Exchange 2010 I have 900+ mail contacts. Recently I migrated from Exchange 2003 and all of these contacts now need to have their SMTP address set as their primary reply, and this somehow was lost during the migration. All the required information is in each mail contact and all I have to do it open the contact, accept a prompt, and Set As Reply on the smtp address that is already there..

This is what I have done in my powershell script which has worked on 1 user:

Code:
set-mailcontact -alias 'alias' -emailaddresses 'SMTP:[email protected]'

My question is, how can I apply a similar script to a large amount of users that each have different Aliases and Different SMTP addresses? The aliases do not match the SMTP address, but ALL aliases start with debtors and then a number. eg debtors4921

I figure I could run

Code:
-alias "debtors*" -emailaddresses 'SMTP:

, but for the SMTP setting, how could I get the command to grab the SMTP information from within the specified alias?

I really don't want to manually click into each of the 900+ contacts...
 
it would be something like this:

get-mailcontact | set-mailcontact -alias $_.alias -emailaddresses <how ever you build it up>

You would pipe one command to another with the aboce, it is essentialy saying take the output from the first cmdlet and use it as the input for the second one.
I don't have direct access to an Exchange box atm, so test it out first. If you don't come right yell again and I will VPN to an Exchange box to check for you.
 
Top
Sign up to the MyBroadband newsletter
X