Quantcast
Channel: Exchange Server 2013 - Administration, Monitoring, and Performance 论坛
Viewing all articles
Browse latest Browse all 8719

Powershell Script to add firstname.lastname@domain.com address to everyone in the company

$
0
0

I am trying to find a script that will allow me to add an additional email address to everyone in the company in the format of:

firstname.lastname@domain.com

I do not want this to be the default address, and I don't want to lose the addresses already assigned to the account.

I have found a lot of questions similar to this one in the forums, and one that seems to be exactly what I want, but it might be dated as it isn't working when I save it as addaddress.ps1 and then run it from the Exchange Management Shell. 

The script I found that is supposed to to exactly what I'm looking for was found in this post:

http://social.technet.microsoft.com/Forums/en-US/bd96d066-fd45-4395-bfb5-ab907396d8a3/exchange-2007-ps-command-to-add-firstnamelastnamemydomaincom-smtp-address?forum=exchangesvrgenerallegacy

It is as follows:

get-mailbox -OrganizationalUnit "OU=Users1,DC=mydomain,DC=COM"
-resultsize unlimited | foreach {
$e=(get-mailbox $_.identity).emailaddresses
$e += ("{0}.{1}@mydomain.com" -f $_.firstname,$_.lastname)
set-mailbox $_.identity -emailaddresses $e

}

The problems is that when I try and run this, I get error that a pipeline is already executing.

Can someone help me out? 

I'm running Exchange 2010 Sp1

Viewing all articles
Browse latest Browse all 8719

Trending Articles



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