• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1052
  • Last Modified:

Exchange 2010 mass change alias?

In exchange 2007 when you mass created mailboxes it would by default set the alias to the username (samaccount) of the user.  In exchange 2010 it grabs FirstnameLastname as the alias.

Is there a shell command that you can run to make the mass change to username?  

And I cannot set an e-mail address policy as our usernames are the first 7 of the lastname and then the first two of the first name.  John Westington would have a username of westingjo.  
0
jruskey
Asked:
jruskey
  • 8
  • 6
1 Solution
 
AkhaterCommented:
$mbxs = get-mailbox -resultsize 1

$mbxs | set-mailbox -Alias $_.SamAccountName

that should do it for one user, if it works change the -resultsize 1 in the above command to -resultsize unlimited to apply it to all
0
 
jruskeyAuthor Commented:
Is there any way to do this for a specific OU?  I want to test it on a single OU before I mass it out.  Please let me know.  Thanks.
0
 
AkhaterCommented:
yea sure

change the first line to

$mbxs = Get-Mailbox -OrganizationalUnit domain.local/users (of corse change that to your ou)

0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
jruskeyAuthor Commented:
I get the attached error on the second line.
error.png
0
 
AkhaterCommented:
the is something wrong please run the first line again and then run

$mbxs

what is the result ?

0
 
AkhaterCommented:
sorry my bad !

the second line should be


$mbxs | set-mailbox $_.DistinguishedName -Alias $_.SamAccountName
0
 
jruskeyAuthor Commented:
The first line works because it gives me the results of the students.  I have tried your new line and still get an error.  It is attached.
error2.png
0
 
AkhaterCommented:
$mbxs | % { set-mailbox $_.DistinguishedName -Alias $_.SamAccountName}
0
 
jruskeyAuthor Commented:
That seemed to have worked perfect.  Any way now to do a mass on that OU and take out the previous alias which was there FirstnameLastname@domain.com?
0
 
AkhaterCommented:
I dot get it you just changed the akias what is the request?
0
 
jruskeyAuthor Commented:
It changed it so that they now are correct in the sense that john smith email address is smithjo@domain.com.  However, it still has a second address in there that lists johnsmith@domain.com.
0
 
AkhaterCommented:
Can you share a screen shot?
0
 
AkhaterCommented:
oh wait you mean now the user has 2 email address and not 2 aliases right ?

if so then don't bother with it it won't show anywhere
0
 
jruskeyAuthor Commented:
Thank you for your help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now