Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3746
  • Last Modified:

Change all users' UPN using powershell

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.
FlofromTO
0
martinichick
Asked:
martinichick
  • 2
1 Solution
 
BSonPoshCommented:
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

0
 
BSonPoshCommented:
Note... use this command to add the snapin after it is downloaded and installed
add-pssnapin Quest.ActiveRoles.ADManagement
0
 
ntr2defCommented:
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
0
 
OutdoorResearchCommented:
Link is broken.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

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