Change all users' UPN using powershell

Posted on 2008-10-29
Medium Priority
Last Modified: 2012-06-18
Hello All,

I need to change UPN suffix for all of my users.  I know that I can change one user's UPN using powershell and the Set-mailbox command.  I'm trying to figure out the syntax to do all users.  I wish there was a parameter for just the SUFFIX of the UPN, but I haven't found anything on that.  So, to change all users, I exported them to a csv file and corrected the UPN in that file.  I was going to run the following command to change the UPN, but I'm getting complaints about the the syntax.  

Import-csv c:\users.csv | Set-Mailbox -Identity $_.identity -UserPrincipalName $_.upn

Can someone give me some guidance?  Thanks so much.
Question by:martinichick
  • 2
LVL 18

Expert Comment

ID: 22833306
With the Quest tools you can do this

dl from here www.question.com/powershell

$users = Get-QADuser -size 0
foreach($user in $users)
   $UPN = "$($user.sAMAccountName)@new.upn"
   $user | Set-QADUser -UserPrincipalName $UPN

Open in new window

LVL 18

Accepted Solution

BSonPosh earned 750 total points
ID: 22833317
Note... use this command to add the snapin after it is downloaded and installed
add-pssnapin Quest.ActiveRoles.ADManagement

Expert Comment

ID: 34666038
how would I go about setting the upn using a csv file but using the DN rather than the samaccountname as we have multiple domains

Expert Comment

ID: 38096361
Link is broken.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

What is the biggest problem in managing an exchange environment today? It is the lack of backups, disaster recovery (DR) plan, testing of the DR plan or believing that it won’t happen to us.
Configure external lookups on for external mail flow on Exchange 2013 and Exchange 2016.
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question